My question concerns writing JAXB plugins, in particular JAXB codemodel.
What is the role of ClassOutline
(and it\'s companions) and JClass
(This is to answer your further questions.)
Yes, it is possible to check customizations. Here is a class I am using to access customizations.
The trick is that reference properties don't have own customizations, customizations are placed in the referenced element properties.
public static CCustomizations getCustomizations(
final CPropertyInfo propertyInfo) {
final CCustomizations main = new CCustomizations(
propertyInfo.getCustomizations());
final Collection elementCustomizations = propertyInfo
.accept(new CPropertyVisitor>() {
public Collection onAttribute(
CAttributePropertyInfo info) {
return Collections.emptyList();
}
public Collection onElement(
CElementPropertyInfo arg0) {
return Collections.emptyList();
}
public Collection onReference(
CReferencePropertyInfo info) {
final List elementCustomizations = new ArrayList(
info.getElements().size());
for (CElement element : info.getElements()) {
if (!(element instanceof CElementInfo && ((CElementInfo) element)
.hasClass())) {
elementCustomizations.add(element
.getCustomizations());
}
}
return elementCustomizations;
}
public Collection onValue(
CValuePropertyInfo arg0) {
return Collections.emptyList();
};
});
CCustomizations customizations = main;
for (CCustomizations e : elementCustomizations) {
main.addAll(e);
}
return customizations;
}
I'd say users@jaxb.java.net is a good place for such discussions.