javax.xml.bind.annotation.XmlElements Java Examples

The following examples show how to use javax.xml.bind.annotation.XmlElements. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CC_GeneralParameterValue.java    From sis with Apache License 2.0 6 votes vote down vote up
/**
 * Invoked by JAXB at marshalling time for getting the actual element to write
 * inside the {@code <gml:parameterValue>} XML element.
 * This is the value or a copy of the value given in argument to the {@code wrap} method.
 *
 * @return the element to be marshalled.
 *
 * @see CC_GeneralOperationParameter#getElement()
 */
@XmlElements({  // We can not use @XmlElementRef because we have no public AbstractParameterValue parent class.
    @XmlElement(name = "ParameterValue",      type = DefaultParameterValue.class),
    @XmlElement(name = "ParameterValueGroup", type = DefaultParameterValueGroup.class)
})
public GeneralParameterValue getElement() {
    final GeneralParameterValue metadata = this.metadata;
    if (metadata instanceof DefaultParameterValue<?>) {
        return (DefaultParameterValue<?>) metadata;
    }
    if (metadata instanceof DefaultParameterValueGroup) {
        return (DefaultParameterValueGroup) metadata;
    }
    if (metadata instanceof ParameterValue) {
        return new DefaultParameterValue<>((ParameterValue<?>) metadata);
    }
    if (metadata instanceof ParameterValueGroup) {
        return new DefaultParameterValueGroup((ParameterValueGroup) metadata);
    }
    return null;    // Unknown types are currently not marshalled (we may revisit that in a future SIS version).
}
 
Example #2
Source File: GO_CharacterString.java    From sis with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the text in a {@code <gco:CharacterString>}, {@code <gcx:FileName>} or {@code <gcx:MimeFileType>}
 * element, or {@code null} if none. This method does not return anything for {@code Enum} or {@code CodeList}
 * instances, as the later are handled by {@link #getCodeList()}.
 *
 * <p>This method is invoked by JAXB at marshalling time and should not need to be invoked directly.</p>
 */
@XmlElements({
    @XmlElement(type = String.class,       name = "CharacterString"),
    @XmlElement(type = Anchor.class,       name = "Anchor",       namespace = Namespaces.GCX),
    @XmlElement(type = FileName.class,     name = "FileName",     namespace = Namespaces.GCX),
    @XmlElement(type = MimeFileType.class, name = "MimeFileType", namespace = Namespaces.GCX),
    @XmlElement(type = GO_URL.class,       name = "URL",          namespace = LegacyNamespaces.GMD)
})
private Object getValue() {
    switch (type) {
        case 0:         return StringAdapter.toString(text);
        case URL:       return new GO_URL(text.toString());
        case FILENAME:  return new FileName(text.toString());
        case MIME_TYPE: return new MimeFileType(text.toString());
        case ANCHOR:    return text;                                // Shall be an instance of Anchor.
        default:        return null;                                // CodeList or Enum.
    }
}
 
Example #3
Source File: CriteriaSupportUtils.java    From rice with Educational Community License v2.0 6 votes vote down vote up
static boolean supportsCriteriaValue(Class<? extends SingleValuedPredicate> simplePredicateClass, CriteriaValue<?> value) {
    if (simplePredicateClass == null) {
        throw new IllegalArgumentException("simplePredicateClass was null");
    }
    if (value == null) {
        throw new IllegalArgumentException("valueClass was null");
    }
    XmlElements elementsAnnotation = CriteriaSupportUtils.findXmlElementsAnnotation(simplePredicateClass);
    if (elementsAnnotation != null) {
        XmlElement[] elements = elementsAnnotation.value();
        for (XmlElement element : elements) {
            if (value.getClass().equals(element.type())) {
                return true;
            }
        }
    }
    return false;
}
 
Example #4
Source File: EndpointElement.java    From ballerina-integrator with Apache License 2.0 5 votes vote down vote up
@XmlElements({
                     @XmlElement(name = "http",
                                 type = HttpEndpoint.class)
             })
public void setEndpoint(Endpoint endpoint) {
    this.endpoint = endpoint;
}
 
Example #5
Source File: XMucAdmin.java    From sissi with Apache License 2.0 5 votes vote down vote up
@XmlElements({ @XmlElement(name = Item.NAME, type = Item.class) })
public List<Item> getItem() {
	return this.items;
}
 
Example #6
Source File: EjbJar.java    From tomee with Apache License 2.0 5 votes vote down vote up
@XmlElementWrapper(name = "enterprise-beans")
@XmlElements({
    @XmlElement(name = "message-driven", required = true, type = MessageDrivenBean.class),
    @XmlElement(name = "session", required = true, type = SessionBean.class),
    @XmlElement(name = "entity", required = true, type = EntityBean.class)})
public EnterpriseBean[] getEnterpriseBeans() {
    return enterpriseBeans.values().toArray(new EnterpriseBean[enterpriseBeans.size()]);
}
 
Example #7
Source File: DefaultEngineeringCRS.java    From sis with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the coordinate system.
 *
 * @return the coordinate system.
 */
@Override
@XmlElements({
    @XmlElement(name = "cartesianCS",   type = DefaultCartesianCS.class),
    @XmlElement(name = "affineCS",      type = DefaultAffineCS.class),
    @XmlElement(name = "cylindricalCS", type = DefaultCylindricalCS.class),
    @XmlElement(name = "linearCS",      type = DefaultLinearCS.class),
    @XmlElement(name = "polarCS",       type = DefaultPolarCS.class),
    @XmlElement(name = "sphericalCS",   type = DefaultSphericalCS.class),
    @XmlElement(name = "userDefinedCS", type = DefaultUserDefinedCS.class)
})
public CoordinateSystem getCoordinateSystem() {
    return super.getCoordinateSystem();
}
 
Example #8
Source File: ClassDiscoverer.java    From jaxb-visitor with Apache License 2.0 5 votes vote down vote up
/**
 * Parse the annotations on the field to see if there is an XmlElements
 * annotation on it. If so, we'll check this annotation to see if it
 * refers to any classes that are external from our code schema compile.
 * If we find any, then we'll add them to our visitor.
 * @param outline root of the generated code
 * @param field parses the xml annotations looking for an external class
 * @param directClasses set of direct classes to append to
 * @throws IllegalAccessException throw if there's an error introspecting the annotations
 */
private static void parseXmlAnnotations(Outline outline, FieldOutline field, Set<String> directClasses) throws IllegalAccessException {
    if (field instanceof UntypedListField) {
        JFieldVar jfv = (JFieldVar) FieldHack.listField.get(field);
        for(JAnnotationUse jau : jfv.annotations()) {
            JClass jc = jau.getAnnotationClass();
            if (jc.fullName().equals(XmlElements.class.getName())) {
                JAnnotationArrayMember value = (JAnnotationArrayMember) jau.getAnnotationMembers().get("value");
                for(JAnnotationUse anno : value.annotations()) {
                    handleXmlElement(outline, directClasses, anno.getAnnotationMembers().get("type"));
                }
            }
        }
    }
}
 
Example #9
Source File: RESTBatchOperation.java    From geofence with GNU General Public License v2.0 5 votes vote down vote up
@XmlElements({
    @XmlElement(name="user",        type=RESTInputUser.class),
    @XmlElement(name="userGroup",   type=RESTInputGroup.class),
    @XmlElement(name="instance",    type=RESTInputInstance.class),
    @XmlElement(name="rule",        type=RESTInputRule.class)
})
public AbstractRESTPayload getPayload() {
    return payload;
}
 
Example #10
Source File: Job.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@XmlElementWrapper(name = "tasks", namespace = "urn:test")
@XmlElements( {
		@XmlElement(name = "usertask", namespace = "urn:test", type = UserTask.class),
		@XmlElement(name = "autotask", namespace = "urn:test", type = AutoTask.class) })
public Collection<Node> getNodes() {
	return nodes;
}
 
Example #11
Source File: JaxbSearch.java    From documentum-rest-client-java with Apache License 2.0 5 votes vote down vote up
@XmlElementWrapper
@XmlElements({@XmlElement(name="expression-set", type=JaxbExpressionSet.class),
    @XmlElement(name="fulltext", type=JaxbFullTextExpression.class),
    @XmlElement(name="property", type=JaxbPropertyExpression.class),
    @XmlElement(name="property-list", type=JaxbPropertyListExpression.class),
    @XmlElement(name="property-range", type=JaxbPropertyRangeExpression.class),
    @XmlElement(name="relative-date", type=JaxbRelativeDateExpression.class)})
public List<Expression> getExpressions() {
    return expressions;
}
 
Example #12
Source File: JaxbSearchTemplate.java    From documentum-rest-client-java with Apache License 2.0 5 votes vote down vote up
@XmlElementWrapper(name = "external-variables")
@XmlElements({@XmlElement(name="property-list-variable", type=JaxbPropertyListVariable.class),
    @XmlElement(name="relative-date-variable", type=JaxbRelativeDateVariable.class),
    @XmlElement(name="property-variable", type=JaxbPropertyValueVariable.class),
    @XmlElement(name="fulltext-variable", type=JaxbFullTextVariable.class)})
@Override
public List<ExternalVariable<?>> getExternalVariables() {
    return externalVariables;
}
 
Example #13
Source File: MCRViewerConfiguration.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
@XmlElements({ @XmlElement(name = "property") })
@XmlElementWrapper(name = "properties")
public final List<MCRIViewClientProperty> getProperties() {
    return properties.entrySet()
        .stream()
        .map(entry -> new MCRIViewClientProperty(entry.getKey(), entry.getValue()))
        .collect(Collectors.toList());
}
 
Example #14
Source File: MCRViewerConfiguration.java    From mycore with GNU General Public License v3.0 5 votes vote down vote up
@XmlElements({ @XmlElement(name = "resource") })
@XmlElementWrapper(name = "resources")
public final List<MCRIViewClientResource> getResources() {
    return resources.entries()
        .stream()
        .map(entry -> new MCRIViewClientResource(entry.getKey(), entry.getValue()))
        .collect(Collectors.toList());
}
 
Example #15
Source File: Application.java    From AndroTickler with Apache License 2.0 5 votes vote down vote up
@XmlElements({
		@XmlElement(name="activity"),
		@XmlElement(name="activity-alias")
})
public void setActivites(List<Activity> activites) {
	this.activites = activites;
}
 
Example #16
Source File: Jaxb2XmlEncoderTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@XmlElements({
		@XmlElement(name="foo", type=Foo.class),
		@XmlElement(name="bar", type=Bar.class)
})
public List<Model> getElements() {
	return Arrays.asList(new Foo("name1"), new Bar("title1"));
}
 
Example #17
Source File: Resource.java    From ballerina-integrator with Apache License 2.0 5 votes vote down vote up
@XmlElements({
                     @XmlElement(name = "inSequence",
                                 type = Sequence.class),
                     @XmlElement(name = "outSequence",
                                 type = Sequence.class)
             })
public void setSequence(Sequence sequence) {
    this.sequenceList.add(sequence);
}
 
Example #18
Source File: Sequence.java    From ballerina-integrator with Apache License 2.0 5 votes vote down vote up
@XmlElements({
                     @XmlElement(name = "call",
                                 type = CallMediator.class),
                     @XmlElement(name = "respond",
                                 type = RespondMediator.class),
                     @XmlElement(name = "payloadFactory",
                                 type = PayloadFactoryMediator.class)
             })
public void setMediator(Mediator mediator) {
    this.mediatorList.add(mediator);
}
 
Example #19
Source File: Jaxb2XmlEncoderTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@XmlElements({
		@XmlElement(name="foo", type=Foo.class),
		@XmlElement(name="bar", type=Bar.class)
})
public List<Model> getElements() {
	return Arrays.asList(new Foo("name1"), new Bar("title1"));
}
 
Example #20
Source File: DiscoInfo.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = DiscoFeature.NAME, type = DiscoFeature.class), @XmlElement(name = Identity.NAME, type = Identity.class) })
public List<DiscoFeature> getDisco() {
	return super.getDisco();
}
 
Example #21
Source File: Search.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = XData.NAME, type = XData.class), @XmlElement(name = Email.NAME, type = Email.class), @XmlElement(name = First.NAME, type = First.class), @XmlElement(name = Last.NAME, type = Last.class), @XmlElement(name = Nick.NAME, type = Nick.class), @XmlElement(name = Item.NAME, type = Item.class), @XmlElement(name = Instructions.NAME, type = Instructions.class) })
public List<Field<?>> getFields() {
	return this.fields.getFields();
}
 
Example #22
Source File: BlockList.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = "item", type = BlockListItem.class) })
public List<BlockListItem> getItem() {
	return this.item;
}
 
Example #23
Source File: Roster.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = GroupItem.NAME, type = GroupItem.class) })
public List<GroupItem> getItem() {
	return this.item;
}
 
Example #24
Source File: GroupItem.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = Group.NAME, type = Group.class) })
public Set<Group> getGroup() {
	return this.groups != null && !this.groups.isEmpty() ? this.groups : null;
}
 
Example #25
Source File: Failure.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = TemporaryAuthFailure.NAME, type = TemporaryAuthFailure.class), @XmlElement(name = MechanismTooWeak.NAME, type = MechanismTooWeak.class), @XmlElement(name = MalformedRequest.NAME, type = MalformedRequest.class), @XmlElement(name = InvalidMechanism.NAME, type = InvalidMechanism.class), @XmlElement(name = IncorrectEncoding.NAME, type = IncorrectEncoding.class), @XmlElement(name = EncryptionRequired.NAME, type = EncryptionRequired.class), @XmlElement(name = CredentialsExpired.NAME, type = CredentialsExpired.class), @XmlElement(name = AccountDisabled.NAME, type = AccountDisabled.class), @XmlElement(name = Aborted.NAME, type = Aborted.class), @XmlElement(name = NotAuthorized.NAME, type = NotAuthorized.class) })
public List<ErrorDetail> getDetails() {
	return this.details;
}
 
Example #26
Source File: Register.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = XData.NAME, type = XData.class), @XmlElement(name = Username.NAME, type = Username.class), @XmlElement(name = Password.NAME, type = Password.class), @XmlElement(name = Registered.NAME, type = Registered.class), @XmlElement(name = Redirect.NAME, type = Redirect.class) })
public List<Field<?>> getFields() {
	return this.fields.getFields();
}
 
Example #27
Source File: VCard.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = Activate.NAME, type = Activate.class),@XmlElement(name = XInput.NAME, type = XInput.class), @XmlElement(name = XNickname.NAME, type = XNickname.class), @XmlElement(name = Photo.NAME, type = Photo.class) })
public List<Field<?>> getFields() {
	return this.fields.getFields();
}
 
Example #28
Source File: Photo.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = Type.NAME, type = Type.class), @XmlElement(name = Binval.NAME, type = Binval.class) })
public List<Field<?>> getFields() {
	return this.fields.getFields();
}
 
Example #29
Source File: DiscoItems.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = Item.NAME, type = Item.class) })
public List<DiscoFeature> getDisco() {
	return super.getDisco();
}
 
Example #30
Source File: IQ.java    From sissi with Apache License 2.0 4 votes vote down vote up
@XmlElements({ @XmlElement(name = Unique.NAME, type = UniqueSequence.class), @XmlElement(name = Last.NAME, type = LastSeconds.class) })
public List<Element> getExtras() {
	return this.extras;
}