![JAR search and dependency download from the Maven repository](/logo.png)
com.sun.tools.xjc.addon.xew.ScopedElementInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jaxb-xew-plugin Show documentation
Show all versions of jaxb-xew-plugin Show documentation
This JAXB plugin utilizes the power of @XmlElementWrapper annotation. Originally xjc trends to create wrapper classes which are the containers for collections. This plugin goes through all properties to find ones which can be represented in the model in more optimal way.
package com.sun.tools.xjc.addon.xew;
import com.sun.codemodel.JExpression;
import com.sun.codemodel.JType;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* Container for information about scoped elements. Elements having the same element name but different semantics need
* separate factory methods to be created in the Object Factory. There should be only one factory method for global (not
* scoped) element and others should have {@code XmlElementDecl.scope} attribute defined. For example here comes global
* (not scoped) and scoped element with the same name {@code age} but different namespaces:
*
*
* @XmlElementDecl(namespace = "http://foo.bar/extra", name = "age")
* public JAXBElement<String> createAge(String value) {
* return new JAXBElement<String>(new QName("http://foo.bar/extra", "age"), String.class, null, value);
* }
*
* @XmlElementDecl(namespace = "http://foo.bar/scope", name = "age", scope = Container.class)
* public JAXBElement<String> createReturnAge(String value) {
* return new JAXBElement<String>(new QName("http://foo.bar/scope", "age"), String.class, Container.class, value);
* }
*
*/
public final class ScopedElementInfo {
/**
* Element name ("post-office").
*/
public final JExpression name;
/**
* Element namespace ("http://foo.bar").
*/
public final JExpression namespace;
/**
* Element type ({@link String}).
*/
public final JType type;
public ScopedElementInfo(JExpression name, JExpression namespace, JType type) {
this.name = name;
this.namespace = namespace;
this.type = type;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy