/** * Constructor with validator. * * @param validator Name of this attribute. */ public MultiAttributeType(AttributeType validator) { super(validator.getLocalName(), List.class, false,1,1,null); this.validator = validator; }
/** * Find the position of an AttributeType which matches the given String. * @param attName the name to look for * @return -1 if not found, zero-based index otherwise */ public int find(String attName) { int i=0; while(i<children.length && !attName.equals(children[i].getLocalName()))i++; return i == children.length?-1:i; }
/** * Find the position of an AttributeType which matches the given String. * @param attName the name to look for * @return -1 if not found, zero-based index otherwise */ public int find(String attName) { int i=0; while(i<children.length && !attName.equals(children[i].getLocalName()))i++; return i == children.length?-1:i; }
/** * Find the position of an AttributeType which matches the given String. * * @param attName the name to look for * * @return -1 if not found, zero-based index otherwise */ public int find(String attName) { int i = 0; while ((i < children.length) && !attName.equals(children[i].getLocalName())) i++; return (i == children.length) ? (-1) : i; }
/** * Find the position of a given AttributeType. * * @param type The type to search for. * * @return -1 if not found, a zero-based index if found. */ public int find(AttributeType type) { if (type == null) return -1; int idx = find(type.getLocalName()); if (idx < 0 || !children[idx].equals(type)) idx = -1; return idx; }
public void setDefaultGeometry(AttributeType defaultGeomtetry) { setDefaultGeometry(defaultGeomtetry.getLocalName()); }
/** * Find the position of a given AttributeType. * * @param type The type to search for. * * @return -1 if not found, a zero-based index if found. */ public int find(AttributeType type) { if (type == null) return -1; int idx = find(type.getLocalName()); if (idx < 0 || !children[idx].equals(type)) idx = -1; return idx; }
/** * Check to see if this factory contains the given AttributeType. The * comparison is done by name. * * @param type The AttributeType to search for by name. * * @return <tt>true</tt> if a like-named AttributeType exists, * <tt>false</tt> otherwise. */ public final boolean contains(AttributeType type) { for (int i = 0, ii = getAttributeCount(); i < ii; i++) { if (get(i).getLocalName().equals(type.getLocalName())) { return true; } } return false; }
/** * Find the position of a given AttributeType. * * @param type The type to search for. * * @return -1 if not found, a zero-based index if found. */ public int find(AttributeType type) { if (type == null) { return -1; } int idx = find(type.getLocalName()); if ((idx < 0) || !children[idx].equals(type)) { idx = -1; } return idx; }
/** * Find the position of a given AttributeType. * * @param type The type to search for. * * @return -1 if not found, a zero-based index if found. */ public int find(AttributeType type) { if (type == null) return -1; int idx = find(type.getLocalName()); if (idx < 0 || !getAttributeDescriptors().get(idx).equals(type)) idx = -1; return idx; }
/** * Returns the qname with prefix as <code>null</code>, and local part the name of the * feature attribute. */ public QName getName() { return new QName(null, featureType.getAttributeType(index).getLocalName()); }
public String[] getPropertyNames(Object object) { Feature feature = (Feature) object; FeatureType featureType = feature.getFeatureType(); //set is ok because jxpath ignores order String[] propertyNames = new String[featureType.getAttributeCount()]; for (int i = 0; i < propertyNames.length; i++) { propertyNames[i] = featureType.getAttributeType(i).getLocalName(); } return propertyNames; }
/** * Returns a string representation of this feature. * * @return A representation of this feature as a string. */ public String toString() { String retString = "Feature[ id=" + getID() + " , "; FeatureType featType = getFeatureType(); List attributes = getAttributes(); for (int i = 0, n = attributes.size(); i < n; i++) { retString += (featType.getAttributeType(i).getLocalName() + "="); retString += attributes.get(i); if ((i + 1) < n) { retString += " , "; } } return retString += " ]"; }
/** * Returns the qname with prefix as <code>null</code>, and local part the name of the * feature attribute. */ public QName getName() { return (index != -1) ? new QName(null, feature.getFeatureType().getAttributeType(index).getLocalName()) : new QName(null, "fid"); }
protected static DefaultFeatureType makeComplex( DefaultFeatureType original ) { DefaultFeatureTypeBuilder builder = new DefaultFeatureTypeBuilder() { protected AttributeDescriptor createAttributeDescriptor(String name, final Class binding) { return new DefaultAttributeType( name, List.class, true, 1,1, null, null ){ public void validate(Object attribute) throws IllegalArgumentException { if ( !binding.isAssignableFrom(attribute.getClass())) { throw new IllegalArgumentException(); } } }; }; }; builder.setName( original.getName().getLocalPart() ); builder.setNamespaceURI(original.getName().getNamespaceURI()); for ( int i = 0; i < original.getAttributeCount(); i++ ) { AttributeType attributeType = original.getAttributeType(i); builder.add( attributeType.getLocalName(), attributeType.getBinding() ); } return (DefaultFeatureType) builder.buildFeatureType(); } }