public FeatureTypeAttributeIterator(NodePointer pointer, ComplexType featureType) { this.pointer = pointer; this.featureType = featureType; // get list of descriptors from types and all supertypes children = Types.descriptors(featureType); position = 1; }
/** * Returns the first descriptor matching the given local name within the given type. * * @param type The type, non null. * @param name The name, non null. * @return The first descriptor, or null if no match. */ public static PropertyDescriptor descriptor(ComplexType type, String name) { List match = descriptors(type, name); if (match.isEmpty()) return null; return (PropertyDescriptor) match.get(0); }
/** * Returns the first descriptor matching the given name within the given type. * * @param type The type, non null. * @param name The name, non null. * @return The first descriptor, or null if no match. */ public static PropertyDescriptor descriptor(ComplexType type, Name name) { List match = descriptors(type, name); if (match.isEmpty()) return null; return (PropertyDescriptor) match.get(0); }
/** * Returns the set of descriptors matching the given name. * * @param type The type, non null. * @param name The name, non null. * @return The list of descriptors named 'name', or an empty list if none such match. */ public static List /* <PropertyDescriptor> */ descriptors(ComplexType type, Name name) { if (name == null) return Collections.EMPTY_LIST; List match = new ArrayList(); for (Iterator itr = type.getDescriptors().iterator(); itr.hasNext(); ) { PropertyDescriptor descriptor = (PropertyDescriptor) itr.next(); Name descriptorName = descriptor.getName(); if (name.equals(descriptorName)) { match.add(descriptor); } } // only look up in the super type if the descriptor is not found // as a direct child definition if (match.size() == 0) { AttributeType superType = type.getSuper(); if (superType instanceof ComplexType) { List superDescriptors = descriptors((ComplexType) superType, name); match.addAll(superDescriptors); } } return match; }
/** * Returns the set of descriptors matching the given local name within the given type. * * @param type The type, non null. * @param name The name, non null. * @return The list of descriptors named 'name', or an empty list if none such match. */ public static List /* <PropertyDescriptor> */ descriptors(ComplexType type, String name) { if (name == null) return Collections.EMPTY_LIST; List match = new ArrayList(); for (Iterator itr = type.getDescriptors().iterator(); itr.hasNext(); ) { PropertyDescriptor descriptor = (PropertyDescriptor) itr.next(); String localPart = descriptor.getName().getLocalPart(); if (name.equals(localPart)) { match.add(descriptor); } } // only look up in the super type if the descriptor is not found // as a direct child definition if (match.size() == 0) { AttributeType superType = type.getSuper(); if (superType instanceof ComplexType) { List superDescriptors = descriptors((ComplexType) superType, name); match.addAll(superDescriptors); } } return match; }
List<PropertyDescriptor> descriptors = descriptors(parentType);
List<PropertyDescriptor> descriptors = descriptors(parentType);
public FeatureTypeAttributeIterator(NodePointer pointer, ComplexType featureType) { this.pointer = pointer; this.featureType = featureType; // get list of descriptors from types and all supertypes children = Types.descriptors(featureType); position = 1; }