javax.xml.bind.annotation.XmlType.propOrder()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中javax.xml.bind.annotation.XmlType.propOrder()方法的一些代码示例,展示了XmlType.propOrder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlType.propOrder()方法的具体详情如下:
包路径:javax.xml.bind.annotation.XmlType
类名称:XmlType
方法名:propOrder

XmlType.propOrder介绍

暂无

代码示例

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

public String[] propOrder() {
  return core.propOrder();
}

代码示例来源:origin: internetarchive/heritrix3

XmlType xmlType = obj.getClass().getAnnotation(XmlType.class);
if (xmlType != null) {
  String[] propOrder = xmlType.propOrder();
  if (propOrder != null) {

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

public String[] propOrder() {
  return core.propOrder();
}

代码示例来源:origin: com.fasterxml.jackson.module/jackson-module-jaxb-annotations

@Override
public String[] findSerializationPropertyOrder(AnnotatedClass ac)
{
  // @XmlType.propOrder fits the bill here:
  XmlType type = findAnnotation(XmlType.class, ac, true, true, true);
  if (type == null) {
    return null;
  }
  String[] order = type.propOrder();
  if (order == null || order.length == 0) {
    return null;
  }
  return order;
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

String[] propOrder = t.propOrder();
if(propOrder.length==0)
  this.propOrder = null;   // unordered

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl

public String[] propOrder() {
  return core.propOrder();
}

代码示例来源:origin: apache/servicemix-bundles

public String[] propOrder() {
  return core.propOrder();
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-core

/**
 * The property order of this xml type.
 *
 * @return The property order of this xml type.
 */
public String[] getPropertyOrder() {
 String[] propertyOrder = null;
 if (xmlType != null) {
  String[] propOrder = xmlType.propOrder();
  if ((propOrder != null) && (propOrder.length > 0) && ((propOrder.length > 1) || !("".equals(propOrder[0])))) {
   propertyOrder = propOrder;
  }
 }
 return propertyOrder;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * The property order of this xml type.
 *
 * @return The property order of this xml type.
 */
public String[] getPropertyOrder() {
 String[] propertyOrder = null;
 if (xmlType != null) {
  String[] propOrder = xmlType.propOrder();
  if ((propOrder != null) && (propOrder.length > 0) && ((propOrder.length > 1) || !("".equals(propOrder[0])))) {
   propertyOrder = propOrder;
  }
 }
 return propertyOrder;
}

代码示例来源:origin: stoicflame/enunciate

/**
 * The property order of this xml type.
 *
 * @return The property order of this xml type.
 */
public String[] getPropertyOrder() {
 String[] propertyOrder = null;
 if (xmlType != null) {
  String[] propOrder = xmlType.propOrder();
  if ((propOrder != null) && (propOrder.length > 0) && ((propOrder.length > 1) || !("".equals(propOrder[0])))) {
   propertyOrder = propOrder;
  }
 }
 return propertyOrder;
}

代码示例来源:origin: com.webcohesion.enunciate/enunciate-jaxb

/**
 * The property order of this xml type.
 *
 * @return The property order of this xml type.
 */
public String[] getPropertyOrder() {
 String[] propertyOrder = null;
 if (xmlType != null) {
  String[] propOrder = xmlType.propOrder();
  if ((propOrder != null) && (propOrder.length > 0) && ((propOrder.length > 1) || !("".equals(propOrder[0])))) {
   propertyOrder = propOrder;
  }
 }
 return propertyOrder;
}

代码示例来源:origin: Nextdoor/bender

@Override
public String[] findSerializationPropertyOrder(AnnotatedClass ac)
{
  // @XmlType.propOrder fits the bill here:
  XmlType type = findAnnotation(XmlType.class, ac, true, true, true);
  if (type == null) {
    return null;
  }
  String[] order = type.propOrder();
  if (order == null || order.length == 0) {
    return null;
  }
  return order;
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

@Override
public String[] findSerializationPropertyOrder(AnnotatedClass ac)
{
  // @XmlType.propOrder fits the bill here:
  XmlType type = findAnnotation(XmlType.class, ac, true, true, true);
  if (type == null) {
    return null;
  }
  String[] order = type.propOrder();
  if (order == null || order.length == 0) {
    return null;
  }
  return order;
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

@Override
public String[] findSerializationPropertyOrder(AnnotatedClass ac)
{
  // @XmlType.propOrder fits the bill here:
  XmlType type = findAnnotation(XmlType.class, ac, true, true, true);
  if (type == null) {
    return null;
  }
  String[] order = type.propOrder();
  if (order == null || order.length == 0) {
    return null;
  }
  return order;
}

代码示例来源:origin: KostyaSha/yet-another-docker-plugin

@Override
public String[] findSerializationPropertyOrder(AnnotatedClass ac)
{
  // @XmlType.propOrder fits the bill here:
  XmlType type = findAnnotation(XmlType.class, ac, true, true, true);
  if (type == null) {
    return null;
  }
  String[] order = type.propOrder();
  if (order == null || order.length == 0) {
    return null;
  }
  return order;
}

代码示例来源:origin: FasterXML/jackson-module-jaxb-annotations

@Override
public String[] findSerializationPropertyOrder(AnnotatedClass ac)
{
  // @XmlType.propOrder fits the bill here:
  XmlType type = findAnnotation(XmlType.class, ac, true, true, true);
  if (type == null) {
    return null;
  }
  String[] order = type.propOrder();
  if (order == null || order.length == 0) {
    return null;
  }
  return order;
}

代码示例来源:origin: com.att.inno/rosetta

private JaxSet(Class<?> cls) {
  members = new TreeMap<String, Setter<T>>();
  XmlType xmltype = cls.getAnnotation(XmlType.class);
  Class<?> paramType[] = new Class[] {String.class};
  for(String str : xmltype.propOrder()) {
    try {
      String setName = "set" + Character.toUpperCase(str.charAt(0)) + str.subSequence(1, str.length());
      Method meth = cls.getMethod(setName,paramType );
      if(meth!=null) {
        members.put(str, new Setter<T>(meth) {
          public void set(T o, Object t) throws ParseException {
            try {
              this.meth.invoke(o, t);
            } catch (Exception e) {
              throw new ParseException(e);
            }
          }
        });
      }
    } catch (Exception e) {
      // oops
    }
  }
}

代码示例来源:origin: apache/sis

/**
 * Uses the {@link XmlType} annotation for defining the property order.
 *
 * @param implementation  the implementation class where to search for {@code XmlType} annotation.
 * @param order           the {@link #order} map where to store the properties order.
 */
private static void defineOrder(Class<?> implementation, final Map<Object,Integer> order) {
  do {
    final XmlType xml = implementation.getAnnotation(XmlType.class);
    if (xml != null) {
      final String[] propOrder = xml.propOrder();
      for (int i=propOrder.length; --i>=0;) {
        /*
         * Add the entries in reverse order because we are iterating from the child class to
         * the parent class, and we want the properties in the parent class to be sorted first.
         * If duplicated properties are found, keep the first occurence (i.e. sort the property
         * with the most specialized child that declared it).
         *
         * We make an exception for ResponsibleParty.role, which should be replaced by Party.role
         * but this replacement is not yet effective in GeoAPI 3.0.
         */
        final String prop = propOrder[i];
        if (!"role".equals(prop) || !ResponsibleParty.class.isAssignableFrom(implementation)) {
          order.putIfAbsent(prop, order.size());
        }
      }
    }
    implementation = implementation.getSuperclass();
  } while (implementation != null);
}

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

String[] propOrder = t.propOrder();
if(propOrder.length==0)
  this.propOrder = null;   // unordered

代码示例来源:origin: javolution/javolution

protected Iterator<CharArray> getXmlPropOrder(final Class<?> classObject){
  AbstractSet<CharArray> propOrderSet = _propOrderCache.get(classObject);
  if(propOrderSet == null && classObject.isAnnotationPresent(XmlType.class)){
    Class<?> thisClass = classObject;
    // Note: The reversed view logic makes sure super class prop orders appear first
    // in the final set, and are in order going all the way down to the final implementation
    // class.
    propOrderSet = new FastSet<CharArray>(Order.lexical()).linked();
    do {
      final XmlType xmlType = thisClass.getAnnotation(XmlType.class);
      final AbstractSet<CharArray> localPropOrderSet = new FastSet<CharArray>(Order.lexical()).linked();
      for(final String prop : xmlType.propOrder()){
        localPropOrderSet.add(getXmlElementName(prop));
      }
      propOrderSet.addAll(localPropOrderSet.reversed());
    }
    while((thisClass = thisClass.getSuperclass()) != null && thisClass != Object.class);
    final AbstractSet<CharArray> propOrderSetCopy = new FastSet<CharArray>().linked();
    propOrderSetCopy.addAll(propOrderSet.reversed());
    propOrderSet = propOrderSetCopy;
    // LogContext.info("Prop Order - "+classObject+" | "+propOrderSet.toString());
    _propOrderCache.put(classObject, propOrderSet);
  }
  return propOrderSet == null ? null : propOrderSet.iterator();
}

相关文章