DirectPropertyAccessorpublic class DirectPropertyAccessor extends Object implements PropertyAccessorAccesses fields directly. |
Methods Summary |
---|
private static java.lang.reflect.Field | getField(java.lang.Class clazz, java.lang.String name)
if ( clazz==null || clazz==Object.class ) {
throw new PropertyNotFoundException("field not found: " + name);
}
Field field;
try {
field = clazz.getDeclaredField(name);
}
catch (NoSuchFieldException nsfe) {
field = getField( clazz, clazz.getSuperclass(), name );
}
if ( !ReflectHelper.isPublic(clazz, field) ) field.setAccessible(true);
return field;
| private static java.lang.reflect.Field | getField(java.lang.Class root, java.lang.Class clazz, java.lang.String name)
if ( clazz==null || clazz==Object.class ) {
throw new PropertyNotFoundException("field [" + name + "] not found on " + root.getName());
}
Field field;
try {
field = clazz.getDeclaredField(name);
}
catch (NoSuchFieldException nsfe) {
field = getField( root, clazz.getSuperclass(), name );
}
if ( !ReflectHelper.isPublic(clazz, field) ) field.setAccessible(true);
return field;
| public Getter | getGetter(java.lang.Class theClass, java.lang.String propertyName)
return new DirectGetter( getField(theClass, propertyName), theClass, propertyName );
| public Setter | getSetter(java.lang.Class theClass, java.lang.String propertyName)
return new DirectSetter( getField(theClass, propertyName), theClass, propertyName );
|
|