Java Code Examples for javax.xml.bind.annotation.XmlElementRef

The following are top voted examples for showing how to use javax.xml.bind.annotation.XmlElementRef. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: ReferencePropertyInfoImpl.java   View source code 5 votes vote down vote up
/**
 * Reads the value of {@code XmlElementRef.required()}.
 *
 * If we are working as 2.1 RI, this defaults to true.
 */
private boolean isRequired(XmlElementRef ref) {
    if(!is2_2)  return true;

    try {
        return ref.required();
    } catch(LinkageError e) {
        is2_2 = false;
        return true;    // the value defaults to true
    }
}
 
Example 2
Project: OpenJSharp   File: ReferencePropertyInfoImpl.java   View source code 5 votes vote down vote up
private String getEffectiveNamespaceFor(XmlElementRef r) {
    String nsUri = r.namespace();

    XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this );
    if(xs!=null && xs.attributeFormDefault()== XmlNsForm.QUALIFIED) {
        // JAX-RPC doesn't want the default namespace URI swapping to take effect to
        // local "unqualified" elements. UGLY.
        if(nsUri.length()==0)
            nsUri = parent.builder.defaultNsUri;
    }

    return nsUri;
}
 
Example 3
Project: jdk8u-jdk   File: DirectoryScannerConfig.java   View source code 5 votes vote down vote up
/**
 * Getter for property includeFiles.
 * This is an array of filters identifying files that should be selected.
 * A file is selected if at least one filter matches.
 * @return Value of property includeFiles.
 */
@XmlElementWrapper(name="IncludeFiles",
        namespace=XmlConfigUtils.NAMESPACE)
@XmlElementRef
public FileMatch[] getIncludeFiles() {
    synchronized(includeFiles) {
        return includeFiles.toArray(new FileMatch[0]);
    }
}
 
Example 4
Project: jdk8u-jdk   File: DirectoryScannerConfig.java   View source code 5 votes vote down vote up
/**
 * Getter for property excludeFiles.
 * This is an array of filters identifying files that should be excluded.
 * A file is excluded if at least one filter matches.
 * @return Value of property excludeFiles.
 */
@XmlElementWrapper(name="ExcludeFiles",
        namespace=XmlConfigUtils.NAMESPACE)
@XmlElementRef
public FileMatch[] getExcludeFiles() {
    synchronized(excludeFiles) {
        return excludeFiles.toArray(new FileMatch[0]);
    }
}
 
Example 5
Project: openjdk-jdk10   File: ReferencePropertyInfoImpl.java   View source code 5 votes vote down vote up
/**
 * Reads the value of {@code XmlElementRef.required()}.
 *
 * If we are working as 2.1 RI, this defaults to true.
 */
private boolean isRequired(XmlElementRef ref) {
    if(!is2_2)  return true;

    try {
        return ref.required();
    } catch(LinkageError e) {
        is2_2 = false;
        return true;    // the value defaults to true
    }
}
 
Example 6
Project: openjdk-jdk10   File: ReferencePropertyInfoImpl.java   View source code 5 votes vote down vote up
private String getEffectiveNamespaceFor(XmlElementRef r) {
    String nsUri = r.namespace();

    XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this );
    if(xs!=null && xs.attributeFormDefault()== XmlNsForm.QUALIFIED) {
        // JAX-RPC doesn't want the default namespace URI swapping to take effect to
        // local "unqualified" elements. UGLY.
        if(nsUri.length()==0)
            nsUri = parent.builder.defaultNsUri;
    }

    return nsUri;
}
 
Example 7
Project: openjdk9   File: DirectoryScannerConfig.java   View source code 5 votes vote down vote up
/**
 * Getter for property includeFiles.
 * This is an array of filters identifying files that should be selected.
 * A file is selected if at least one filter matches.
 * @return Value of property includeFiles.
 */
@XmlElementWrapper(name="IncludeFiles",
        namespace=XmlConfigUtils.NAMESPACE)
@XmlElementRef
public FileMatch[] getIncludeFiles() {
    synchronized(includeFiles) {
        return includeFiles.toArray(new FileMatch[0]);
    }
}
 
Example 8
Project: openjdk9   File: DirectoryScannerConfig.java   View source code 5 votes vote down vote up
/**
 * Getter for property excludeFiles.
 * This is an array of filters identifying files that should be excluded.
 * A file is excluded if at least one filter matches.
 * @return Value of property excludeFiles.
 */
@XmlElementWrapper(name="ExcludeFiles",
        namespace=XmlConfigUtils.NAMESPACE)
@XmlElementRef
public FileMatch[] getExcludeFiles() {
    synchronized(excludeFiles) {
        return excludeFiles.toArray(new FileMatch[0]);
    }
}
 
Example 9
Project: openjdk9   File: ReferencePropertyInfoImpl.java   View source code 5 votes vote down vote up
/**
 * Reads the value of {@code XmlElementRef.required()}.
 *
 * If we are working as 2.1 RI, this defaults to true.
 */
private boolean isRequired(XmlElementRef ref) {
    if(!is2_2)  return true;

    try {
        return ref.required();
    } catch(LinkageError e) {
        is2_2 = false;
        return true;    // the value defaults to true
    }
}
 
Example 10
Project: openjdk9   File: ReferencePropertyInfoImpl.java   View source code 5 votes vote down vote up
private String getEffectiveNamespaceFor(XmlElementRef r) {
    String nsUri = r.namespace();

    XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this );
    if(xs!=null && xs.attributeFormDefault()== XmlNsForm.QUALIFIED) {
        // JAX-RPC doesn't want the default namespace URI swapping to take effect to
        // local "unqualified" elements. UGLY.
        if(nsUri.length()==0)
            nsUri = parent.builder.defaultNsUri;
    }

    return nsUri;
}
 
Example 11
Project: engerek   File: PrismBeanInspector.java   View source code 5 votes vote down vote up
private Field lookupSubstitutionUncached(Class beanClass, Method elementMethodInObjectFactory) {
    XmlElementDecl xmlElementDecl = elementMethodInObjectFactory.getAnnotation(XmlElementDecl.class);
    if (xmlElementDecl == null) {
        return null;
    }
    final String substitutionHeadName = xmlElementDecl.substitutionHeadName();
    return findField(beanClass, field -> {
        XmlElementRef xmlElementRef = field.getAnnotation(XmlElementRef.class);
        return xmlElementRef != null && xmlElementRef.name().equals(substitutionHeadName);
    });
}
 
Example 12
Project: jdk8u_jdk   File: DirectoryScannerConfig.java   View source code 5 votes vote down vote up
/**
 * Getter for property includeFiles.
 * This is an array of filters identifying files that should be selected.
 * A file is selected if at least one filter matches.
 * @return Value of property includeFiles.
 */
@XmlElementWrapper(name="IncludeFiles",
        namespace=XmlConfigUtils.NAMESPACE)
@XmlElementRef
public FileMatch[] getIncludeFiles() {
    synchronized(includeFiles) {
        return includeFiles.toArray(new FileMatch[0]);
    }
}
 
Example 13
Project: jdk8u_jdk   File: DirectoryScannerConfig.java   View source code 5 votes vote down vote up
/**
 * Getter for property excludeFiles.
 * This is an array of filters identifying files that should be excluded.
 * A file is excluded if at least one filter matches.
 * @return Value of property excludeFiles.
 */
@XmlElementWrapper(name="ExcludeFiles",
        namespace=XmlConfigUtils.NAMESPACE)
@XmlElementRef
public FileMatch[] getExcludeFiles() {
    synchronized(excludeFiles) {
        return excludeFiles.toArray(new FileMatch[0]);
    }
}
 
Example 14
Project: lookaside_java-1.8.0-openjdk   File: DirectoryScannerConfig.java   View source code 5 votes vote down vote up
/**
 * Getter for property includeFiles.
 * This is an array of filters identifying files that should be selected.
 * A file is selected if at least one filter matches.
 * @return Value of property includeFiles.
 */
@XmlElementWrapper(name="IncludeFiles",
        namespace=XmlConfigUtils.NAMESPACE)
@XmlElementRef
public FileMatch[] getIncludeFiles() {
    synchronized(includeFiles) {
        return includeFiles.toArray(new FileMatch[0]);
    }
}
 
Example 15
Project: lookaside_java-1.8.0-openjdk   File: DirectoryScannerConfig.java   View source code 5 votes vote down vote up
/**
 * Getter for property excludeFiles.
 * This is an array of filters identifying files that should be excluded.
 * A file is excluded if at least one filter matches.
 * @return Value of property excludeFiles.
 */
@XmlElementWrapper(name="ExcludeFiles",
        namespace=XmlConfigUtils.NAMESPACE)
@XmlElementRef
public FileMatch[] getExcludeFiles() {
    synchronized(excludeFiles) {
        return excludeFiles.toArray(new FileMatch[0]);
    }
}
 
Example 16
Project: lookaside_java-1.8.0-openjdk   File: ReferencePropertyInfoImpl.java   View source code 5 votes vote down vote up
/**
 * Reads the value of {@code XmlElementRef.required()}.
 *
 * If we are working as 2.1 RI, this defaults to true.
 */
private boolean isRequired(XmlElementRef ref) {
    if(!is2_2)  return true;

    try {
        return ref.required();
    } catch(LinkageError e) {
        is2_2 = false;
        return true;    // the value defaults to true
    }
}
 
Example 17
Project: lookaside_java-1.8.0-openjdk   File: ReferencePropertyInfoImpl.java   View source code 5 votes vote down vote up
private String getEffectiveNamespaceFor(XmlElementRef r) {
    String nsUri = r.namespace();

    XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this );
    if(xs!=null && xs.attributeFormDefault()== XmlNsForm.QUALIFIED) {
        // JAX-RPC doesn't want the default namespace URI swapping to take effect to
        // local "unqualified" elements. UGLY.
        if(nsUri.length()==0)
            nsUri = parent.builder.defaultNsUri;
    }

    return nsUri;
}
 
Example 18
Project: Camel   File: EipAnnotationProcessor.java   View source code 5 votes vote down vote up
/**
 * Special for processing an @XmlElementRef when field
 */
private void processRefWhenClauses(RoundEnvironment roundEnv, TypeElement originalClassType, XmlElementRef elementRef,
                                   VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) {
    Elements elementUtils = processingEnv.getElementUtils();

    if ("whenClauses".equals(fieldName)) {
        String kind = "element";
        String name = elementRef.name();
        if (isNullOrEmpty(name) || "##default".equals(name)) {
            name = fieldName;
        }
        name = prefix + name;
        TypeMirror fieldType = fieldElement.asType();
        String fieldTypeName = fieldType.toString();

        // find javadoc from original class as it will override the setExpression method where we can provide the javadoc for the given EIP
        String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, originalClassType, true);
        boolean deprecated = fieldElement.getAnnotation(Deprecated.class) != null;

        // indicate that this element is one of when
        Set<String> oneOfTypes = new HashSet<String>();
        oneOfTypes.add("when");

        EipOption ep = new EipOption(name, kind, fieldTypeName, false, "", docComment, deprecated, false, null, true, oneOfTypes);
        eipOptions.add(ep);
    }
}
 
Example 19
Project: biomedicus   File: CasMappings.java   View source code 5 votes vote down vote up
/**
 * Gets the mappings from rtf control words to UIMA annotations.
 *
 * @return list containing mappings
 */
@XmlElementWrapper(required = true)
@XmlElementRef(name = "controlWordCasMapping")
@Nullable
public List<ControlWordCasMapping> getControlWordCasMappings() {
  return controlWordCasMappings;
}
 
Example 20
Project: biomedicus   File: CasMappings.java   View source code 5 votes vote down vote up
/**
 * Gets the mappings from rtf destinations to UIMA CAS views.
 *
 * @return list of the mappings.
 */
@XmlElementWrapper(required = true)
@XmlElementRef(name = "destinationCasMapping")
@Nullable
public List<DestinationCasMapping> getDestinationCasMappings() {
  return destinationCasMappings;
}
 
Example 21
Project: jira2vertec-Gateway   File: VertecSoapCreate.java   View source code 5 votes vote down vote up
@XmlElementRefs({
        @XmlElementRef(name = "OffeneLeistung", type = VertecOffeneLeistung.class),
        @XmlElementRef(name = "VerrechneteLeistung", type = VertecVerrechneteLeistung.class),
        @XmlElementRef(name = "ProjektBearbeiter", type = VertecProjektBearbeiter.class),
        @XmlElementRef(name = "Projekt", type = VertecProject.class),
        @XmlElementRef(name = "ProjektPhase", type = VertecPhase.class)})
@XmlAnyElement
public void setItem(T item)
{
    this.item = item;
}
 
Example 22
Project: jira2vertec-Gateway   File: VertecSoapUpdate.java   View source code 5 votes vote down vote up
@XmlElementRefs({
        @XmlElementRef(name = "OffeneLeistung", type = VertecOffeneLeistung.class),
        @XmlElementRef(name = "VerrechneteLeistung", type = VertecVerrechneteLeistung.class),
        @XmlElementRef(name = "ProjektBearbeiter", type = VertecProjektBearbeiter.class),
        @XmlElementRef(name = "Projekt", type = VertecProject.class),
        @XmlElementRef(name = "ProjektPhase", type = VertecPhase.class)})
@XmlAnyElement
public void setItem(T item)
{
    this.item = item;
}
 
Example 23
Project: Camel   File: RouteDefinition.java   View source code 5 votes vote down vote up
/**
 * Outputs are processors that determines how messages are processed by this route.
 */
@XmlElementRef
public void setOutputs(List<ProcessorDefinition<?>> outputs) {
    this.outputs = outputs;

    if (outputs != null) {
        for (ProcessorDefinition<?> output : outputs) {
            configureChild(output);
        }
    }
}
 
Example 24
Project: Camel   File: EipAnnotationProcessor.java   View source code 5 votes vote down vote up
/**
 * Special for processing an @XmlElementRef routes field
 */
private void processRoutes(RoundEnvironment roundEnv, TypeElement originalClassType, XmlElementRef elementRef,
                           VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) {
    if ("routes".equals(fieldName)) {

        TypeMirror fieldType = fieldElement.asType();
        String fieldTypeName = fieldType.toString();

        Set<String> oneOfTypes = new TreeSet<String>();
        oneOfTypes.add("route");

        EipOption ep = new EipOption("routes", "element", fieldTypeName, false, "", "Contains the Camel routes", false, false, null, true, oneOfTypes);
        eipOptions.add(ep);
    }
}
 
Example 25
Project: Camel   File: EipAnnotationProcessor.java   View source code 5 votes vote down vote up
/**
 * Special for processing an @XmlElementRef rests field
 */
private void processRests(RoundEnvironment roundEnv, TypeElement originalClassType, XmlElementRef elementRef,
                           VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) {
    if ("rests".equals(fieldName)) {

        TypeMirror fieldType = fieldElement.asType();
        String fieldTypeName = fieldType.toString();

        Set<String> oneOfTypes = new TreeSet<String>();
        oneOfTypes.add("rest");

        EipOption ep = new EipOption("rests", "element", fieldTypeName, false, "", "Contains the rest services defined using the rest-dsl", false, false, null, true, oneOfTypes);
        eipOptions.add(ep);
    }
}
 
Example 26
Project: Camel   File: EipAnnotationProcessor.java   View source code 5 votes vote down vote up
/**
 * Special for processing an @XmlElementRef outputs field
 */
private void processOutputs(RoundEnvironment roundEnv, TypeElement originalClassType, XmlElementRef elementRef,
                            VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) {
    if ("outputs".equals(fieldName) && supportOutputs(originalClassType)) {
        String kind = "element";
        String name = elementRef.name();
        if (isNullOrEmpty(name) || "##default".equals(name)) {
            name = fieldName;
        }
        name = prefix + name;
        TypeMirror fieldType = fieldElement.asType();
        String fieldTypeName = fieldType.toString();

        // gather oneOf which extends any of the output base classes
        Set<String> oneOfTypes = new TreeSet<String>();
        // find all classes that has that superClassName
        Set<TypeElement> children = new LinkedHashSet<TypeElement>();
        for (String superclass : ONE_OF_OUTPUTS) {
            findTypeElementChildren(roundEnv, children, superclass);
        }
        for (TypeElement child : children) {
            XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class);
            if (rootElement != null) {
                String childName = rootElement.name();
                if (childName != null) {
                    oneOfTypes.add(childName);
                }
            }
        }

        // remove some types which are not intended as an output in eips
        oneOfTypes.remove("route");

        EipOption ep = new EipOption(name, kind, fieldTypeName, true, "", "", false, false, null, true, oneOfTypes);
        eipOptions.add(ep);
    }
}
 
Example 27
Project: Camel   File: EipAnnotationProcessor.java   View source code 5 votes vote down vote up
/**
 * Special for processing an @XmlElementRef verbs field (rest-dsl)
 */
private void processVerbs(RoundEnvironment roundEnv, TypeElement originalClassType, XmlElementRef elementRef,
                          VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) {

    Elements elementUtils = processingEnv.getElementUtils();

    if ("verbs".equals(fieldName) && supportOutputs(originalClassType)) {
        String kind = "element";
        String name = elementRef.name();
        if (isNullOrEmpty(name) || "##default".equals(name)) {
            name = fieldName;
        }
        name = prefix + name;
        TypeMirror fieldType = fieldElement.asType();
        String fieldTypeName = fieldType.toString();

        String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, originalClassType, true);

        // gather oneOf which extends any of the output base classes
        Set<String> oneOfTypes = new TreeSet<String>();
        // find all classes that has that superClassName
        Set<TypeElement> children = new LinkedHashSet<TypeElement>();
        for (String superclass : ONE_OF_VERBS) {
            findTypeElementChildren(roundEnv, children, superclass);
        }
        for (TypeElement child : children) {
            XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class);
            if (rootElement != null) {
                String childName = rootElement.name();
                if (childName != null) {
                    oneOfTypes.add(childName);
                }
            }
        }

        EipOption ep = new EipOption(name, kind, fieldTypeName, true, "", docComment, false, false, null, true, oneOfTypes);
        eipOptions.add(ep);
    }
}
 
Example 28
Project: OpenJSharp   File: XmlElementRefsQuick.java   View source code 4 votes vote down vote up
public XmlElementRef[] value() {
    return core.value();
}
 
Example 29
Project: OpenJSharp   File: XmlElementRefQuick.java   View source code 4 votes vote down vote up
public XmlElementRefQuick(Locatable upstream, XmlElementRef core) {
    super(upstream);
    this.core = core;
}
 
Example 30
Project: OpenJSharp   File: XmlElementRefQuick.java   View source code 4 votes vote down vote up
protected Quick newInstance(Locatable upstream, Annotation core) {
    return new XmlElementRefQuick(upstream, ((XmlElementRef) core));
}
 
Example 31
Project: OpenJSharp   File: XmlElementRefQuick.java   View source code 4 votes vote down vote up
public Class<XmlElementRef> annotationType() {
    return XmlElementRef.class;
}
 
Example 32
Project: OpenJSharp   File: ReferencePropertyInfoImpl.java   View source code 4 votes vote down vote up
/**
 * @return
 *      true if the reference yields at least one type
 */
private boolean addGenericElement(XmlElementRef r) {
    String nsUri = getEffectiveNamespaceFor(r);
    // TODO: check spec. defaulting of localName.
    return addGenericElement(parent.owner.getElementInfo(parent.getClazz(),new QName(nsUri,r.name())));
}
 
Example 33
Project: OpenJSharp   File: ReferencePropertyInfoImpl.java   View source code 4 votes vote down vote up
private boolean addGenericElement(XmlElementRef r, ReferencePropertyInfoImpl<T,C,F,M> info) {
    String nsUri = info.getEffectiveNamespaceFor(r);
    ElementInfo ei = parent.owner.getElementInfo(info.parent.getClazz(), new QName(nsUri, r.name()));
    types.add(ei);
    return true;
}
 
Example 34
Project: openjdk-jdk10   File: XmlElementRefsQuick.java   View source code 4 votes vote down vote up
public XmlElementRef[] value() {
    return core.value();
}
 
Example 35
Project: openjdk-jdk10   File: XmlElementRefQuick.java   View source code 4 votes vote down vote up
public XmlElementRefQuick(Locatable upstream, XmlElementRef core) {
    super(upstream);
    this.core = core;
}
 
Example 36
Project: openjdk-jdk10   File: XmlElementRefQuick.java   View source code 4 votes vote down vote up
protected Quick newInstance(Locatable upstream, Annotation core) {
    return new XmlElementRefQuick(upstream, ((XmlElementRef) core));
}
 
Example 37
Project: openjdk-jdk10   File: XmlElementRefQuick.java   View source code 4 votes vote down vote up
public Class<XmlElementRef> annotationType() {
    return XmlElementRef.class;
}
 
Example 38
Project: openjdk-jdk10   File: ReferencePropertyInfoImpl.java   View source code 4 votes vote down vote up
/**
 * @return
 *      true if the reference yields at least one type
 */
private boolean addGenericElement(XmlElementRef r) {
    String nsUri = getEffectiveNamespaceFor(r);
    // TODO: check spec. defaulting of localName.
    return addGenericElement(parent.owner.getElementInfo(parent.getClazz(),new QName(nsUri,r.name())));
}
 
Example 39
Project: openjdk-jdk10   File: ReferencePropertyInfoImpl.java   View source code 4 votes vote down vote up
private boolean addGenericElement(XmlElementRef r, ReferencePropertyInfoImpl<T,C,F,M> info) {
    String nsUri = info.getEffectiveNamespaceFor(r);
    ElementInfo ei = parent.owner.getElementInfo(info.parent.getClazz(), new QName(nsUri, r.name()));
    types.add(ei);
    return true;
}
 
Example 40
Project: ditb   File: TableListModel.java   View source code 4 votes vote down vote up
/**
 * @return the tables
 */
@XmlElementRef(name="table")
public List<TableModel> getTables() {
  return tables;
}