type.setGenerated(true);
_prepare.renameClass(type.getBeanClass().getName(),
type.getBeanClass().getName());
GenClass javaClass = new GenClass(type.getInstanceClassName());
javaClass.setSuperClassName(type.getBeanClass().getName());
javaClass.addImport("java.util.logging.*");
javaClass.addImport("com.caucho.amber.manager.*");
javaClass.addImport("com.caucho.amber.entity.*");
javaClass.addImport("com.caucho.amber.type.*");
ClassComponent componentGenerator
= type.getComponentGenerator();
if (componentGenerator instanceof AmberMappedComponent) {
AmberMappedComponent entityGenerator
= (AmberMappedComponent) componentGenerator;
// type is EntityType or MappedSuperclassType
javaClass.addInterfaceName(type.getComponentInterfaceName());
type.setEnhanced(true);
entityGenerator.setRelatedType((EntityType) type);
entityGenerator.setBaseClassName(type.getBeanClass().getName());
//String extClassName = gen.getBaseClassName() + "__ResinExt";
// type.setInstanceClassName(extClassName);
entityGenerator.setExtClassName(type.getInstanceClassName());
javaClass.addComponent(componentGenerator);
}
else if (type instanceof ListenerType) {
javaClass.addInterfaceName("com.caucho.amber.entity.Listener");
type.setEnhanced(true);
ListenerComponent listener = new ListenerComponent();
listener.setListenerType((ListenerType) type);
listener.setBaseClassName(type.getBeanClass().getName());
listener.setExtClassName(type.getInstanceClassName());
javaClass.addComponent(listener);
}
else if (componentGenerator instanceof EmbeddableComponent) {
EmbeddableComponent embeddable
= (EmbeddableComponent) componentGenerator;
javaClass.addInterfaceName("com.caucho.amber.entity.Embeddable");
type.setEnhanced(true);
embeddable.setEmbeddableType((EmbeddableType) type);
embeddable.setBaseClassName(type.getBeanClass().getName());
embeddable.setExtClassName(type.getInstanceClassName());
javaClass.addComponent(embeddable);
}
javaGen.generate(javaClass);
// _pendingClassNames.add(extClassName);