1 16 package org.directwebremoting.impl; 17 18 import java.lang.reflect.Field ; 19 import java.lang.reflect.Method ; 20 21 import org.directwebremoting.extend.MarshallException; 22 import org.directwebremoting.extend.Property; 23 24 28 public class FieldProperty implements Property 29 { 30 33 public FieldProperty(Field field) 34 { 35 this.field = field; 36 } 37 38 41 public String getName() 42 { 43 return field.getName(); 44 } 45 46 49 public Class getPropertyType() 50 { 51 return field.getType(); 52 } 53 54 57 public Object getValue(Object bean) throws MarshallException 58 { 59 try 60 { 61 return field.get(bean); 62 } 63 catch (Exception ex) 64 { 65 throw new MarshallException(bean.getClass(), ex); 66 } 67 } 68 69 72 public void setValue(Object bean, Object value) throws MarshallException 73 { 74 try 75 { 76 field.set(bean, value); 77 } 78 catch (Exception ex) 79 { 80 throw new MarshallException(bean.getClass(), ex); 81 } 82 } 83 84 87 public Method getSetter() 88 { 89 return null; 90 } 91 92 95 private Field field; 96 } 97 | Popular Tags |