Hi,
> If I create a new class like:
> CodeModelClassFactory classFactory = outline.getClassFactory();
> coordinateClass = classFactory.createClass(kmlpackage, JMod.PUBLIC,
> "Coordinate", null, ClassType.CLASS);
>
> // other class related stuff
>
>
> the class doesn’t show up, if I iterate over the getClasses-collection:
> for (final ClassOutline classOutline : outline.getClasses()) {
> createHashCodeAndEqualsMethod((ClassOutlineImpl) classOutline);
> LOG.info("---------> " + classOutline.implClass.fullName());
> }
>
> Could you tell me, what’s the proper way, to add a new class in a JAXB
> plugin and to process the created class later (in the same plugin)?
CodeModelClassFactory has nothing to do with class outlines.
If you want to create an additional schema-derived class, you actually
have to create a new CClassInfo during the "postprocess model" phase
in your plugin. ClassOutline will be automatically generated by the
bean generator.
The generation sequence in XJC is model (CClassInfo, CPropertyInfo) ->
outline (ClassOutline, FieldOutline) -> rendered code (JClass, ...).
ps. I'm not sure if you are aware of jaxb2-commons "basic" plugins:
https://jaxb2-commons.dev.java.net/source/browse/jaxb2-commons/basic/src/main/java/org/jvnet/jaxb2_commons/plugin/
They might be helpful if you develop your own plugins. You can also
check Hyperjaxb3 for code examples on working with XJC model:
https://hj3.dev.java.net/svn/hj3/trunk/ejb/plugin/src/main/java/org/jvnet/hyperjaxb3/ejb/strategy/model/base/
Bye.
/lexi