if ( traitPackage == null ) {
traitPackage = new Package( pack );
traitPackage.setClassFieldAccessorCache( ruleBase.getClassFieldAccessorCache() );
ruleBase.getPackagesMap().put( pack, traitPackage );
}
ClassFieldAccessorStore store = traitPackage.getClassFieldAccessorStore();
// ClassFieldAccessorStore store = ((JavaDialectRuntimeData.TypeDeclarationClassLoader) ruleBase.getTypeDeclarationClassLoader()).getAccessorStore();
String className = coreKlazz.getName() + "Wrapper";
String superClass = coreKlazz.getName();
String[] interfaces = new String[] {CoreWrapper.class.getName()};
ClassDefinition def = new ClassDefinition( className, superClass, interfaces );
def.setTraitable(true);
def.setDefinedClass( wrapperClass );
Map<String, Field> fields = inspector.getFieldTypesField();
for ( Field f : fields.values() ) {
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 );
}