/** * Return an iterator that will operate on a collection of values (as would be returned by getProperties or * getFieldList) sorted by their name (ElementInterface.getName()). */ public Iterator getSortedIterator() { Iterator it = null; try { // Use getProperties to get the values in list form (rather than as generic collection) List propList = Arrays.asList(getProperties()); // Use the element comparator to sort the properties by name (based on ElementInterface) Collections.sort(propList, new ElementComparator()); // Iterate over the sorted property list it = propList.iterator(); } catch (ClassCastException ccex) { // If sorting by the comparator resulted in a ClassCastException (possible), // iterate over the generic collection of values. it = getFieldList().iterator(); } return it; }
public Element[] getProperties() { @SuppressWarnings("unchecked") java.util.Collection<BaseProperty> coll = getCollection().getFieldList(); if (coll == null) { return null; } Property[] properties = new Property[coll.size()]; int i = 0; for (BaseProperty prop : coll) { properties[i++] = new Property(prop, getXWikiContext()); } return properties; }
/** * @return an array with the properties of the class */ @Override public Element[] getProperties() { @SuppressWarnings("unchecked") java.util.Collection<com.xpn.xwiki.objects.classes.PropertyClass> coll = getCollection().getFieldList(); if (coll == null) { return null; } PropertyClass[] properties = new PropertyClass[coll.size()]; int i = 0; for (com.xpn.xwiki.objects.classes.PropertyClass prop : coll) { properties[i++] = new PropertyClass(prop, getXWikiContext()); } Arrays.sort(properties, new PropertyComparator()); return properties; }
for (Iterator it = object.getFieldList().iterator(); it.hasNext();) { BaseElement property = (BaseElement) it.next(); if (!handledProps.contains(property.getName())) {