if ( f != null ) {
FieldDefinition fld = new FieldDefinition();
fld.setName( f.getName() );
fld.setTypeName( f.getType().getName() );
fld.setInherited( true );
ClassFieldAccessor accessor = store.getAccessor( def.getDefinedClass().getName(),
fld.getName() );
fld.setReadWriteAccessor( accessor );
def.addField( fld );
}
}
} else {
String className = klazz.getName();
String superClass = Object.class.getName();
String[] interfaces = new String[ klazz.getInterfaces().length ];
for ( int j = 0; j < klazz.getInterfaces().length; j++ ) {
interfaces[ j ] = klazz.getInterfaces()[ j ].getName();
}
def = new ClassDefinition( className, superClass, interfaces );
def.setDefinedClass( klazz );
Map<String, Method> properties = inspector.getGetterMethods();
for ( String key : properties.keySet() ) {
Method m = properties.get( key );
if ( m != null && m.getDeclaringClass() != TraitType.class && m.getDeclaringClass() != Thing.class && inspector.getSetterMethods().containsKey( key ) ) {
FieldDefinition fld = new FieldDefinition();
fld.setName( getterToFieldName( m.getName() ) );
fld.setTypeName( m.getReturnType().getName() );
fld.setInherited( true );
ClassFieldAccessor accessor = store.getAccessor( def.getDefinedClass().getName(),
fld.getName() );
fld.setReadWriteAccessor( accessor );
def.addField( fld );
}