Search in sources :

Example 1 with XmlSchemaTypes

use of jakarta.xml.bind.annotation.XmlSchemaTypes in project jaxb-ri by eclipse-ee4j.

the class Util method calcSchemaType.

static <T, C, F, M> QName calcSchemaType(AnnotationReader<T, C, F, M> reader, AnnotationSource primarySource, C enclosingClass, T individualType, Locatable src) {
    XmlSchemaType xst = primarySource.readAnnotation(XmlSchemaType.class);
    if (xst != null) {
        return new QName(xst.namespace(), xst.name());
    }
    // check the defaulted annotation
    XmlSchemaTypes xsts = reader.getPackageAnnotation(XmlSchemaTypes.class, enclosingClass, src);
    XmlSchemaType[] values = null;
    if (xsts != null)
        values = xsts.value();
    else {
        xst = reader.getPackageAnnotation(XmlSchemaType.class, enclosingClass, src);
        if (xst != null) {
            values = new XmlSchemaType[1];
            values[0] = xst;
        }
    }
    if (values != null) {
        for (XmlSchemaType item : values) {
            if (reader.getClassValue(item, "type").equals(individualType)) {
                return new QName(item.namespace(), item.name());
            }
        }
    }
    return null;
}
Also used : QName(javax.xml.namespace.QName) XmlSchemaType(jakarta.xml.bind.annotation.XmlSchemaType) XmlSchemaTypes(jakarta.xml.bind.annotation.XmlSchemaTypes)

Example 2 with XmlSchemaTypes

use of jakarta.xml.bind.annotation.XmlSchemaTypes in project eclipselink by eclipse-ee4j.

the class AnnotationsProcessor method processSchemaTypes.

/**
 * Process any @XmlSchemaType(s).
 */
private void processSchemaTypes(JavaClass javaClass, TypeInfo info) {
    JavaPackage pack = javaClass.getPackage();
    if (helper.isAnnotationPresent(pack, XmlSchemaTypes.class)) {
        XmlSchemaTypes types = (XmlSchemaTypes) helper.getAnnotation(pack, XmlSchemaTypes.class);
        XmlSchemaType[] typeArray = types.value();
        for (XmlSchemaType next : typeArray) {
            processSchemaType(next);
        }
    } else if (helper.isAnnotationPresent(pack, XmlSchemaType.class)) {
        processSchemaType((XmlSchemaType) helper.getAnnotation(pack, XmlSchemaType.class));
    }
}
Also used : XmlSchemaType(jakarta.xml.bind.annotation.XmlSchemaType) JavaPackage(org.eclipse.persistence.jaxb.javamodel.JavaPackage) XmlSchemaTypes(jakarta.xml.bind.annotation.XmlSchemaTypes)

Aggregations

XmlSchemaType (jakarta.xml.bind.annotation.XmlSchemaType)2 XmlSchemaTypes (jakarta.xml.bind.annotation.XmlSchemaTypes)2 QName (javax.xml.namespace.QName)1 JavaPackage (org.eclipse.persistence.jaxb.javamodel.JavaPackage)1