本文整理汇总了Java中javax.xml.bind.annotation.XmlElementWrapper类的典型用法代码示例。如果您正苦于以下问题:Java XmlElementWrapper类的具体用法?Java XmlElementWrapper怎么用?Java XmlElementWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmlElementWrapper类属于javax.xml.bind.annotation包,在下文中一共展示了XmlElementWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItemType
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
public TypeInfo getItemType() {
if (type instanceof Class && ((Class)type).isArray() && !byte[].class.equals(type)) {
Type componentType = ((Class)type).getComponentType();
Type genericComponentType = null;
if (genericType!= null && genericType instanceof GenericArrayType) {
GenericArrayType arrayType = (GenericArrayType) type;
genericComponentType = arrayType.getGenericComponentType();
componentType = arrayType.getGenericComponentType();
}
TypeInfo ti =new TypeInfo(tagName, componentType, annotations);
if (genericComponentType != null) ti.setGenericType(genericComponentType);
for(Annotation anno : annotations) if (anno instanceof XmlElementWrapper) ti.wrapperType = this;
return ti;
}
// if (type instanceof Class && java.util.Collection.class.isAssignableFrom((Class)type)) {
Type t = (genericType != null)? genericType : type;
Type base = Utils.REFLECTION_NAVIGATOR.getBaseClass(t, Collection.class);
if ( base != null) {
return new TypeInfo(tagName, Utils.REFLECTION_NAVIGATOR.getTypeArgument(base,0), annotations);
}
return null;
}
示例2: getRoles
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
@Transient
@XmlElementWrapper(name = "roles")
@XmlElement(name = "role")
private MCRRole[] getRoles() {
if (getSystemRoleIDs().isEmpty() && getExternalRoleIDs().isEmpty()) {
return null;
}
ArrayList<String> roleIds = new ArrayList<>(getSystemRoleIDs().size() + getExternalRoleIDs().size());
Collection<MCRRole> roles = new ArrayList<>(roleIds.size());
roleIds.addAll(getSystemRoleIDs());
roleIds.addAll(getExternalRoleIDs());
for (String roleName : roleIds) {
MCRRole role = MCRRoleManager.getRole(roleName);
if (role == null) {
throw new MCRException("Could not load role: " + roleName);
}
roles.add(role);
}
return roles.toArray(new MCRRole[roles.size()]);
}
示例3: getAttributesMap
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
@Transient
@XmlElementWrapper(name = "attributes")
@XmlElement(name = "attribute")
private MapEntry[] getAttributesMap() {
if (attributes == null) {
return null;
}
ArrayList<MapEntry> list = new ArrayList<>(attributes.size());
for (Entry<String, String> entry : attributes.entrySet()) {
MapEntry mapEntry = new MapEntry();
mapEntry.name = entry.getKey();
mapEntry.value = entry.getValue();
list.add(mapEntry);
}
return list.toArray(new MapEntry[list.size()]);
}
示例4: getSimulationSetups
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
/**
* Gets the list of simulation setups.
* @return the simulation setups
*/
@XmlElementWrapper(name = "simulationSetups")
public SimulationSetups getSimulationSetups() {
if (this.simulationSetups == null) {
this.simulationSetups = new SimulationSetups(this, this.getSimulationSetupCurrent());
}
return this.simulationSetups;
}
示例5: ERPropertyInfoImpl
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
public ERPropertyInfoImpl(ClassInfoImpl<TypeT, ClassDeclT, FieldT, MethodT> classInfo, PropertySeed<TypeT, ClassDeclT, FieldT, MethodT> propertySeed) {
super(classInfo, propertySeed);
XmlElementWrapper e = seed.readAnnotation(XmlElementWrapper.class);
boolean nil = false;
boolean required = false;
if(!isCollection()) {
xmlName = null;
if(e!=null)
classInfo.builder.reportError(new IllegalAnnotationException(
Messages.XML_ELEMENT_WRAPPER_ON_NON_COLLECTION.format(
nav().getClassName(parent.getClazz())+'.'+seed.getName()),
e
));
} else {
if(e!=null) {
xmlName = calcXmlName(e);
nil = e.nillable();
required = e.required();
} else
xmlName = null;
}
wrapperNillable = nil;
wrapperRequired = required;
}
示例6: calcXmlName
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
/**
* Computes the tag name from a {@link XmlElementWrapper} by taking the defaulting into account.
*/
protected final QName calcXmlName(XmlElementWrapper e) {
if(e!=null)
return calcXmlName(e.namespace(),e.name());
else
return calcXmlName("##default","##default");
}
示例7: getValues
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
@XmlElementWrapper(name = "values")
@XmlElements({
@XmlElement(name = "byte", type = Byte.class),
@XmlElement(name = "double", type = Double.class),
@XmlElement(name = "float", type = Float.class),
@XmlElement(name = "short", type = Short.class),
@XmlElement(name = "integer", type = Integer.class),
@XmlElement(name = "long", type = Long.class),
@XmlElement(name = "string", type = String.class)
})
public List<Object> getValues() {
return values;
}
示例8: getIncludeFiles
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
/**
* 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]);
}
}
示例9: getExcludeFiles
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
/**
* 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]);
}
}
示例10: getSerializedElements
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
private List<SchemaElement> getSerializedElements(Field[] fields) {
List<SchemaElement> elements = new ArrayList<>();
for (Field field : fields) {
Class<?> elementType = field.getType();
String elementName = field.getName();
String wrapperName = null;
XmlElementWrapper xmlWrapper = field.getAnnotation(XmlElementWrapper.class);
if (xmlWrapper != null) {
// 首先判断是否为数组元素
wrapperName = xmlWrapper.name();
}
XmlElement xmlElement = field.getAnnotation(XmlElement.class);
if (xmlElement != null) {
if (!xmlElement.name().equals("##default")) {
elementName = xmlElement.name();
}
if (xmlElement.type() != null && !xmlElement.type().getName().startsWith(XmlElement.class.getName())) {
elementType = xmlElement.type();
}
} else {
continue;
}
if (elementName == null) {
continue;
}
if (elementType == null) {
continue;
}
elements.add(new SchemaElement(elementName, wrapperName, elementType));
}
return elements;
}
示例11: getRunningplan
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
/**
* returns the running plans
*
* @return list with running plans
*/
@Nonnull
@XmlElementWrapper( name = "runningplans" )
@XmlElement( name = "runningplan" )
public final List<ITerm> getRunningplan()
{
return m_runningplan;
}
示例12: getResultObjects
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
@Override
@XmlElementWrapper(name = "ResultObjects")
@XmlElement(name = "ResultObject")
public final ArrayList<P> getResultObjects() {
if (this.resultObjects == null) {
this.resultObjects = new ArrayList<P>();
}
return this.resultObjects;
}
示例13: getInformations
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
@Override
@XmlElementWrapper(name = "Informations")
@XmlElement(name = "Information", type = OperationInformation.class)
public final ArrayList<IOperationInformation> getInformations() {
if (this.informations == null) {
this.informations = new ArrayList<IOperationInformation>();
}
return this.informations;
}
示例14: getConditions
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
@Override
@XmlElementWrapper(name = "Conditions")
@XmlElement(name = "Condition", type = Condition.class)
public final IConditions getConditions() {
if (this.conditions == null) {
this.conditions = new Conditions();
}
return this.conditions;
}
示例15: getChildCriterias
import javax.xml.bind.annotation.XmlElementWrapper; //导入依赖的package包/类
@Override
@XmlElementWrapper(name = "ChildCriterias")
@XmlElement(name = "ChildCriteria", type = ChildCriteria.class, nillable = true)
public final IChildCriterias getChildCriterias() {
if (this.childCriterias == null) {
this.childCriterias = new ChildCriterias();
}
return this.childCriterias;
}