/** * @param type AttributeType (often attribute.getType() ) * @param attribute Attribute being tested * @param attributeContent Content of the attribute (often attribute.getValue() ) * @throws IllegalAttributeException */ public static void validate(AttributeType type, Attribute attribute, Object attributeContent) throws IllegalAttributeException { validate(type, attribute, attributeContent, false); }
/** * @param name * @return * @deprecated use {@link #toTypeName(QName} */ public static Name toName(QName name) { return toTypeName(name); }
public PropertyDescriptor getDescriptor() { return Types.findDescriptor(parentType, name); }
/** * Template method for creating an attribute name. * * @return {@link org.geotools.feature.Types#typeName(String, String)} */ protected Name createName(String ns, String local) { return Types.typeName(ns, local); }
validate((AttributeType) type, (Attribute) attribute, (Object) content, false); validateAll(type, attribute, content); validate((ComplexType) type.getSuper(), attribute, content);
Types.toQName( Types.typeName(elemDecl.getTargetNamespace(), elemDecl.getName())); for (SchemaIndex schemaIndex : schemas) { elemDecl = schemaIndex.getElementDeclaration(qname); String targetNamespace = typeDefinition.getTargetNamespace(); String name = typeDefinition.getName(); Name typeName = Types.typeName(targetNamespace, name); type = getAttributeType(typeName, typeDefinition, crs); if (type == null) { String name = elemDecl.getName(); String targetNamespace = elemDecl.getTargetNamespace(); Name overrideName = Types.typeName(targetNamespace, name); type = createType(overrideName, typeDefinition, crs, true);
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; }
public static QName toQName(Name featurePath) { return toQName(featurePath, null); }
public static boolean equals(Name targetNodeName, StepList targetXPath) { if (targetXPath.size() == 1) { Step rootStep = targetXPath.get(0); QName stepName = rootStep.getName(); if (Types.equals(targetNodeName, stepName)) { return true; } } return false; } }
/** * Template method for creating a type name. * * @return {@link org.geotools.feature.iso.Types#typeName(String, String)} */ protected Name createTypeName(String ns, String local) { return Types.typeName(ns, local); }
Types.toQName( Types.typeName(elemDecl.getTargetNamespace(), elemDecl.getName())); for (SchemaIndex schemaIndex : schemas) { elemDecl = schemaIndex.getElementDeclaration(qname); String targetNamespace = typeDefinition.getTargetNamespace(); String name = typeDefinition.getName(); Name typeName = Types.typeName(targetNamespace, name); type = getAttributeType(typeName, typeDefinition, crs); if (type == null) { String name = elemDecl.getName(); String targetNamespace = elemDecl.getTargetNamespace(); Name overrideName = Types.typeName(targetNamespace, name); type = createType(overrideName, typeDefinition, crs, true);
/** * 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); }
private XSDTypeDefinition getTypeDefinition(Name typeName) { QName qName = Types.toQName(typeName); XSDTypeDefinition typeDefinition = null; for (SchemaIndex schemaIndex : schemas) { typeDefinition = schemaIndex.getTypeDefinition(qName); if (typeDefinition != null) { break; } } if (typeDefinition == null) { throw new IllegalArgumentException( "XSD type definition not found in schemas: " + qName); } return typeDefinition; }
Name rootName = root.getName(); QName stepName = step.getName(); if (Types.equals(rootName, stepName)) { LOGGER.fine("removing root name from xpath " + steps + " as it is redundant"); steps.remove(0);
/** * Validates content against an attribute. * * @param attribute The attribute. * @param attributeContent Content of attribute (often attribute.getValue() * @throws IllegalAttributeException In the event that content violates any restrictions * specified by the attribute. */ public static void validate(Attribute attribute, Object attributeContent) throws IllegalAttributeException { validate(attribute.getType(), attribute, attributeContent, false); } /**
/** * Creates a set of type names from a set of strings. * * <p>This method returns null if names == null. * * <p>The ith name has getLocalPart() == names[i] and getNamespaceURI() == null */ public static Name[] toTypeNames(String[] names) { if (names == null) { return null; } Name[] typeNames = new Name[names.length]; for (int i = 0; i < names.length; i++) { typeNames[i] = typeName(names[i]); } return typeNames; }
/** * Returns whether <code>typeDefinition</code> has an ancestor named <code>baseTypeName</code>. * * @param typeDefinition * @param baseTypeName * @return */ private static boolean isDerivedFrom( final XSDTypeDefinition typeDefinition, final QName baseTypeName) { return isDerivedFrom(typeDefinition, Types.toTypeName(baseTypeName)); }
protected AttributeDescriptor attributeDescriptor(Name name) { PropertyDescriptor descriptor = Types.findDescriptor((ComplexType) type, name); if (descriptor == null) { String msg = "Could not locate attribute: " + name + " in type: " + type.getName(); throw new IllegalArgumentException(msg); } if (!(descriptor instanceof AttributeDescriptor)) { String msg = name + " references a non attribute"; throw new IllegalArgumentException(msg); } return (AttributeDescriptor) descriptor; }
/** * 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); }
private XSDElementDeclaration getElementDeclaration(final Name descriptorName) { QName qname = Types.toQName(descriptorName); XSDElementDeclaration elemDecl = null; for (SchemaIndex schemaIndex : schemas) { elemDecl = schemaIndex.getElementDeclaration(qname); if (elemDecl != null) { break; } } if (elemDecl == null) { String msg = "No top level element found in schemas: " + qname; LOGGER.log(Level.WARNING, msg); throw new NoSuchElementException(msg); } return elemDecl; }