/** * 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 } }
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; }
/** * 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]); } }
/** * 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]); } }
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); }); }
/** * 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); } }
/** * 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; }
/** * 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; }
@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; }
/** * 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); } } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
public XmlElementRef[] value() { return core.value(); }
public XmlElementRefQuick(Locatable upstream, XmlElementRef core) { super(upstream); this.core = core; }
protected Quick newInstance(Locatable upstream, Annotation core) { return new XmlElementRefQuick(upstream, ((XmlElementRef) core)); }
public Class<XmlElementRef> annotationType() { return XmlElementRef.class; }
/** * @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()))); }
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; }
/** * @return the tables */ @XmlElementRef(name="table") public List<TableModel> getTables() { return tables; }