use of com.sun.tools.xjc.reader.xmlschema.bindinfo.BIDeclaration in project jaxb-ri by eclipse-ee4j.
the class UnusedCustomizationChecker method check.
private void check(BIDeclaration decl, XSComponent c) {
if (!decl.isAcknowledged()) {
getErrorReporter().error(decl.getLocation(), Messages.ERR_UNACKNOWLEDGED_CUSTOMIZATION, decl.getName().getLocalPart());
getErrorReporter().error(c.getLocator(), Messages.ERR_UNACKNOWLEDGED_CUSTOMIZATION_LOCATION);
// mark it as acknowledged to avoid
// duplicated error messages.
decl.markAsAcknowledged();
}
for (BIDeclaration d : decl.getChildren()) check(d, c);
}
use of com.sun.tools.xjc.reader.xmlschema.bindinfo.BIDeclaration in project midpoint by Evolveum.
the class SchemaProcessor method getFieldReferenceUseAnnotationQName.
// e.g. c:link (as opposed to c:linkRef)
private QName getFieldReferenceUseAnnotationQName(JFieldVar field, ClassOutline classOutline) {
BIDeclaration declaration = hasAnnotation(classOutline, field, A_OBJECT_REFERENCE);
if (!(declaration instanceof BIXPluginCustomization)) {
return null;
}
BIXPluginCustomization customization = (BIXPluginCustomization) declaration;
if (customization.element == null) {
return null;
}
Element element = customization.element;
String strQName = element.getTextContent();
String[] array = strQName.split(":");
if (array.length == 2) {
return new QName(PrefixMapper.C.getNamespace(), array[1]);
} else if (array.length == 1) {
return new QName(PrefixMapper.C.getNamespace(), array[0]);
}
return null;
}
use of com.sun.tools.xjc.reader.xmlschema.bindinfo.BIDeclaration in project midpoint by Evolveum.
the class ProcessorUtils method hasAnnotation.
private static BIDeclaration hasAnnotation(XSAnnotation annotation, QName qname) {
if (annotation == null) {
return null;
}
Object object = annotation.getAnnotation();
if (!(object instanceof BindInfo)) {
return null;
}
BindInfo info = (BindInfo) object;
BIDeclaration[] declarations = info.getDecls();
if (declarations == null) {
return null;
}
for (BIDeclaration declaration : declarations) {
if (qname.equals(declaration.getName())) {
return declaration;
}
}
return null;
}
use of com.sun.tools.xjc.reader.xmlschema.bindinfo.BIDeclaration in project jaxb-ri by eclipse-ee4j.
the class BGMBuilder method checkMultipleSchemaBindings.
/**
* Reports an error if there are more than one jaxb:schemaBindings customization.
*/
private void checkMultipleSchemaBindings(XSSchema schema) {
ArrayList<Locator> locations = new ArrayList<>();
BindInfo bi = getBindInfo(schema);
for (BIDeclaration bid : bi) {
if (bid.getName() == BISchemaBinding.NAME)
locations.add(bid.getLocation());
}
// OK
if (locations.size() <= 1)
return;
// error
getErrorReporter().error(locations.get(0), Messages.ERR_MULTIPLE_SCHEMA_BINDINGS, schema.getTargetNamespace());
for (int i = 1; i < locations.size(); i++) getErrorReporter().error(locations.get(i), Messages.ERR_MULTIPLE_SCHEMA_BINDINGS_LOCATION);
}
Aggregations