public String[] propOrder() { return core.propOrder(); }
XmlType xmlType = obj.getClass().getAnnotation(XmlType.class); if (xmlType != null) { String[] propOrder = xmlType.propOrder(); if (propOrder != null) {
public String[] propOrder() { return core.propOrder(); }
@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; }
String[] propOrder = t.propOrder(); if(propOrder.length==0) this.propOrder = null; // unordered
public String[] propOrder() { return core.propOrder(); }
public String[] propOrder() { return core.propOrder(); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
@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; }
@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; }
@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; }
@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; }
@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; }
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 } } }
/** * 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); }
String[] propOrder = t.propOrder(); if(propOrder.length==0) this.propOrder = null; // unordered
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(); }