1 16 package net.sf.dozer.util.mapping.propertydescriptor; 17 18 import net.sf.dozer.util.mapping.fieldmap.Field; 19 import net.sf.dozer.util.mapping.util.MapperConstants; 20 21 24 public class PropertyDescriptorFactory { 25 26 private PropertyDescriptorFactory() { 27 } 28 29 public static DozerPropertyDescriptorIF getPropertyDescriptor(Field field, Class bean) throws NoSuchFieldException { 30 DozerPropertyDescriptorIF desc = null; 31 if (field.getName().equals(MapperConstants.SELF_KEYWORD) && field.getTheGetMethod() == null 33 && field.getTheSetMethod() == null) { 34 desc = new SelfPropertyDescriptor(bean); 35 } else if (field.isAccessible()) { 36 desc = new FieldPropertyDescriptor(bean, field.getName(), field.isAccessible()); 37 } else { 39 desc = new BruteForcePropertyDescriptor(field); 41 } 42 return desc; 43 } 44 } | Popular Tags |