org.geotools.feature
Class Types

java.lang.Object
  extended by org.geotools.feature.Types

public class Types
extends java.lang.Object

This is a set of utility methods used when implementing types.

This set of classes captures the all important how does it work questions, particularly with respect to super types.

FIXME: These methods need a Q&A check to confirm correct use of Super TODO: Cannot tell the difference in intent from FeatureTypes

Author:
Jody Garnett, Refractions Research, Justin Deoliveira, The Open Planning Project

Constructor Summary
Types()
           
 
Method Summary
static org.opengis.feature.type.Name degloseName(java.lang.String prefixedName, org.xml.sax.helpers.NamespaceSupport namespaces)
          Takes a prefixed attribute name and returns an Name by looking which namespace belongs the prefix to in AppSchemaDataAccessDTO.getNamespaces().
static org.opengis.feature.type.PropertyDescriptor descriptor(org.opengis.feature.type.ComplexType type, org.opengis.feature.type.Name name)
          Returns the first descriptor matching the given name within the given type.
static org.opengis.feature.type.PropertyDescriptor descriptor(org.opengis.feature.type.ComplexType type, org.opengis.feature.type.Name name, org.opengis.feature.type.AttributeType actualType)
           
static org.opengis.feature.type.PropertyDescriptor descriptor(org.opengis.feature.type.ComplexType type, java.lang.String name)
          Returns the first descriptor matching the given local name within the given type.
static org.opengis.feature.type.PropertyDescriptor descriptor(org.opengis.feature.type.ComplexType type, java.lang.String name, org.opengis.feature.type.AttributeType actualType)
          Returns the first descriptor matching the given local name within the given type.
static org.opengis.feature.type.PropertyDescriptor descriptor(org.opengis.feature.type.ComplexType type, java.lang.String name, java.lang.String namespace)
          Returns the first descriptor matching the given name + namespace within the given type.
static java.util.List descriptors(org.opengis.feature.type.ComplexType type, org.opengis.feature.type.Name name)
          Returns the set of descriptors matching the given name.
static java.util.List descriptors(org.opengis.feature.type.ComplexType type, java.lang.String name)
          Returns the set of descriptors matching the given local name within the given type.
static boolean equals(org.opengis.feature.type.Name name, javax.xml.namespace.QName qName)
           
static java.lang.String[] fromNames(org.opengis.feature.type.Name[] attributeNames)
          Convenience method for turning an array of qualified names into a list of non qualified names.
static java.lang.String[] fromTypeNames(org.opengis.feature.type.Name[] typeNames)
          Convenience method for turning an array of qualified names into a list of non qualified names.
static boolean isSuperType(org.opengis.feature.type.PropertyType type, org.opengis.feature.type.PropertyType parent)
          Determines if parent is a super type of type
static org.opengis.feature.type.Name[] names(org.opengis.feature.type.ComplexType type)
          Returns The name of attributes defined in the type.
static java.lang.Object parse(org.opengis.feature.type.AttributeType type, java.lang.Object content)
          Converts content into a format which is used to store it internally within an attribute of a specific type.
static org.opengis.feature.type.Name toName(javax.xml.namespace.QName name)
          Deprecated. use #toTypeName(QName
static org.opengis.feature.type.Name[] toNames(java.lang.String[] names)
          Creates a set of attribute names from a set of strings.
static javax.xml.namespace.QName toQName(org.opengis.feature.type.Name featurePath)
           
static javax.xml.namespace.QName toQName(org.opengis.feature.type.Name featurePath, org.xml.sax.helpers.NamespaceSupport ns)
           
static org.opengis.feature.type.Name toTypeName(javax.xml.namespace.QName name)
           
static org.opengis.feature.type.Name[] toTypeNames(java.lang.String[] names)
          Creates a set of type names from a set of strings.
static org.opengis.feature.type.Name typeName(org.opengis.feature.type.Name name)
          Creates a type name from another name.
static org.opengis.feature.type.Name typeName(java.lang.String name)
          Creates a type name from a single non-qualified string.
static org.opengis.feature.type.Name typeName(java.lang.String namespace, java.lang.String name)
          Creates an attribute name from a single non-qualified string.
static void validate(org.opengis.feature.Attribute attribute)
          Validates anattribute.
static void validate(org.opengis.feature.Attribute attribute, java.lang.Object attributeContent)
          Validates content against an attribute.
static void validate(org.opengis.feature.type.AttributeType type, org.opengis.feature.Attribute attribute, java.lang.Object attributeContent)
           
protected static void validate(org.opengis.feature.type.AttributeType type, org.opengis.feature.Attribute attribute, java.lang.Object attributeContent, boolean isSuper)
           
static void validate(org.opengis.feature.ComplexAttribute attribute)
           
static void validate(org.opengis.feature.ComplexAttribute attribute, java.util.Collection content)
           
protected static void validate(org.opengis.feature.type.ComplexType type, org.opengis.feature.ComplexAttribute attribute, java.util.Collection content)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Types

public Types()
Method Detail

names

public static org.opengis.feature.type.Name[] names(org.opengis.feature.type.ComplexType type)
Returns The name of attributes defined in the type.

Parameters:
type - The type.

typeName

public static org.opengis.feature.type.Name typeName(java.lang.String name)
Creates a type name from a single non-qualified string.

Parameters:
name - The name, may be null
Returns:
The name in which getLocalPart() == name and getNamespaceURI() == null. Or null if name == null.

typeName

public static org.opengis.feature.type.Name typeName(java.lang.String namespace,
                                                     java.lang.String name)
Creates an attribute name from a single non-qualified string.

Parameters:
name - The name, may be null
namespace - The scope or namespace, may be null.
Returns:
The name in which getLocalPart() == name and getNamespaceURI() == namespace.

typeName

public static org.opengis.feature.type.Name typeName(org.opengis.feature.type.Name name)
Creates a type name from another name.

Parameters:
name - The other name.

toNames

public static org.opengis.feature.type.Name[] toNames(java.lang.String[] names)
Creates a set of attribute names from a set of strings.

This method returns null if names == null.

The ith name has getLocalPart() == names[i] and getNamespaceURI() == null


toTypeNames

public static org.opengis.feature.type.Name[] toTypeNames(java.lang.String[] names)
Creates a set of type names from a set of strings.

This method returns null if names == null.

The ith name has getLocalPart() == names[i] and getNamespaceURI() == null


fromNames

public static java.lang.String[] fromNames(org.opengis.feature.type.Name[] attributeNames)
Convenience method for turning an array of qualified names into a list of non qualified names.


fromTypeNames

public static java.lang.String[] fromTypeNames(org.opengis.feature.type.Name[] typeNames)
Convenience method for turning an array of qualified names into a list of non qualified names.


descriptor

public static org.opengis.feature.type.PropertyDescriptor descriptor(org.opengis.feature.type.ComplexType type,
                                                                     java.lang.String name)
Returns the first descriptor matching the given local name within the given type.

Parameters:
type - The type, non null.
name - The name, non null.
Returns:
The first descriptor, or null if no match.

descriptor

public static org.opengis.feature.type.PropertyDescriptor descriptor(org.opengis.feature.type.ComplexType type,
                                                                     java.lang.String name,
                                                                     org.opengis.feature.type.AttributeType actualType)
Returns the first descriptor matching the given local name within the given type.

Parameters:
type - The type, non null.
name - The name, non null.
Returns:
The first descriptor, or null if no match.

descriptor

public static org.opengis.feature.type.PropertyDescriptor descriptor(org.opengis.feature.type.ComplexType type,
                                                                     org.opengis.feature.type.Name name,
                                                                     org.opengis.feature.type.AttributeType actualType)

descriptor

public static org.opengis.feature.type.PropertyDescriptor descriptor(org.opengis.feature.type.ComplexType type,
                                                                     java.lang.String name,
                                                                     java.lang.String namespace)
Returns the first descriptor matching the given name + namespace within the given type.

Parameters:
type - The type, non null.
name - The name, non null.
namespace - The namespace, non null.
Returns:
The first descriptor, or null if no match.

descriptor

public static org.opengis.feature.type.PropertyDescriptor descriptor(org.opengis.feature.type.ComplexType type,
                                                                     org.opengis.feature.type.Name name)
Returns the first descriptor matching the given name within the given type.

Parameters:
type - The type, non null.
name - The name, non null.
Returns:
The first descriptor, or null if no match.

descriptors

public static java.util.List descriptors(org.opengis.feature.type.ComplexType type,
                                         java.lang.String name)
Returns the set of descriptors matching the given local name within the given type.

Parameters:
type - The type, non null.
name - The name, non null.
Returns:
The list of descriptors named 'name', or an empty list if none such match.

descriptors

public static java.util.List descriptors(org.opengis.feature.type.ComplexType type,
                                         org.opengis.feature.type.Name name)
Returns the set of descriptors matching the given name.

Parameters:
type - The type, non null.
name - The name, non null.
Returns:
The list of descriptors named 'name', or an empty list if none such match.

isSuperType

public static boolean isSuperType(org.opengis.feature.type.PropertyType type,
                                  org.opengis.feature.type.PropertyType parent)
Determines if parent is a super type of type

Parameters:
type - The type in question.
parent - The possible parent type.

parse

public static java.lang.Object parse(org.opengis.feature.type.AttributeType type,
                                     java.lang.Object content)
                              throws java.lang.IllegalArgumentException
Converts content into a format which is used to store it internally within an attribute of a specific type.

Parameters:
value - the object to attempt parsing of.
Throws:
java.lang.IllegalArgumentException - if parsing is attempted and is unsuccessful.

validate

public static void validate(org.opengis.feature.Attribute attribute)
                     throws org.opengis.feature.IllegalAttributeException
Validates anattribute.

Same result as calling:

        
 validate(attribute.type(), attribute)
 
 

Parameters:
attribute - The attribute.
Throws:
IllegalAttributeException - In the event that content violates any restrictions specified by the attribute.
org.opengis.feature.IllegalAttributeException

validate

public static void validate(org.opengis.feature.Attribute attribute,
                            java.lang.Object attributeContent)
                     throws org.opengis.feature.IllegalAttributeException
Validates content against an attribute.

Parameters:
attribute - The attribute.
attributeContent - Content of attribute.
Throws:
IllegalAttributeException - In the event that content violates any restrictions specified by the attribute.
org.opengis.feature.IllegalAttributeException

validate

public static void validate(org.opengis.feature.type.AttributeType type,
                            org.opengis.feature.Attribute attribute,
                            java.lang.Object attributeContent)
                     throws org.opengis.feature.IllegalAttributeException
Throws:
org.opengis.feature.IllegalAttributeException

validate

protected static void validate(org.opengis.feature.type.AttributeType type,
                               org.opengis.feature.Attribute attribute,
                               java.lang.Object attributeContent,
                               boolean isSuper)
                        throws org.opengis.feature.IllegalAttributeException
Throws:
org.opengis.feature.IllegalAttributeException

validate

public static void validate(org.opengis.feature.ComplexAttribute attribute)
                     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

validate

public static void validate(org.opengis.feature.ComplexAttribute attribute,
                            java.util.Collection content)
                     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

validate

protected static void validate(org.opengis.feature.type.ComplexType type,
                               org.opengis.feature.ComplexAttribute attribute,
                               java.util.Collection content)
                        throws org.opengis.feature.IllegalAttributeException
Throws:
org.opengis.feature.IllegalAttributeException

toQName

public static javax.xml.namespace.QName toQName(org.opengis.feature.type.Name featurePath)

toQName

public static javax.xml.namespace.QName toQName(org.opengis.feature.type.Name featurePath,
                                                org.xml.sax.helpers.NamespaceSupport ns)

toName

public static org.opengis.feature.type.Name toName(javax.xml.namespace.QName name)
Deprecated. use #toTypeName(QName

Parameters:
name -
Returns:

toTypeName

public static org.opengis.feature.type.Name toTypeName(javax.xml.namespace.QName name)

equals

public static boolean equals(org.opengis.feature.type.Name name,
                             javax.xml.namespace.QName qName)

degloseName

public static org.opengis.feature.type.Name degloseName(java.lang.String prefixedName,
                                                        org.xml.sax.helpers.NamespaceSupport namespaces)
                                                 throws java.lang.IllegalArgumentException
Takes a prefixed attribute name and returns an Name by looking which namespace belongs the prefix to in AppSchemaDataAccessDTO.getNamespaces().

Parameters:
prefixedName - , namespaces
Returns:
Throws:
java.lang.IllegalArgumentException - if prefixedName has no declared namespace in app-schema config file.


Copyright © 1996-2010 Geotools. All Rights Reserved.