|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.feature.DefaultFeatureType
A basic implementation of FeatureType.
Field Summary | |
static FeatureType |
EMPTY
An feature type with no attributes |
Constructor Summary | |
DefaultFeatureType(java.lang.String typeName,
java.lang.String namespace,
java.util.Collection types,
java.util.Collection superTypes,
GeometryAttributeType defaultGeom)
|
|
DefaultFeatureType(java.lang.String typeName,
java.net.URI namespace,
java.util.Collection types,
java.util.Collection superTypes,
GeometryAttributeType defaultGeom)
Constructs a new DefaultFeatureType. |
Method Summary | |
Feature |
create(java.lang.Object[] attributes)
Creates a new feature, with a generated unique featureID. |
Feature |
create(java.lang.Object[] attributes,
java.lang.String featureID)
Creates a new feature, with the proper featureID, using this FeatureType. |
Feature |
duplicate(Feature original)
Create a duplicate of the provided feature, must delegate to an appropriate FeatureFactory create method. |
boolean |
equals(FeatureType other)
|
boolean |
equals(java.lang.Object other)
FeatureType check based on namespace, typeName, attributes and ancestors. |
int |
find(AttributeType type)
Find the position of a given AttributeType. |
int |
find(java.lang.String attName)
Find the position of an AttributeType which matches the given String. |
FeatureType[] |
getAncestors()
Obtain an array of this FeatureTypes ancestors. |
int |
getAttributeCount()
Returns the number of attributes at the first 'level' of the schema. |
AttributeType |
getAttributeType(int position)
Gets the attributeType at the specified index. |
AttributeType |
getAttributeType(java.lang.String xPath)
Gets the attributeType at this xPath, if the specified attributeType does not exist then null is returned. |
AttributeType[] |
getAttributeTypes()
AttributeTypes for this FeatureType, all attributes defined by this FeatureType and its super types define schema for feature instances. |
GeometryAttributeType |
getDefaultGeometry()
Gets the default geometry AttributeType. |
java.net.URI |
getNamespace()
Gets the global schema namespace. |
java.lang.String |
getTypeName()
Gets the type name for this schema. |
boolean |
hasAttributeType(java.lang.String xPath)
This is only used twice in the whole geotools code base, and one of those is for a test, so we're removing it from the interface. |
int |
hashCode()
Hascode based on namespace, typeName, attributes and ancestors. |
boolean |
isAbstract()
Is this FeatureType an abstract type? |
boolean |
isDescendedFrom(FeatureType type)
A convenience method for calling FeatureType f1; FeatureType f2;
f1.isDescendedFrom(f2.getNamespace(),f2.getName()); |
boolean |
isDescendedFrom(java.net.URI nsURI,
java.lang.String typeName1)
Test to determine whether this FeatureType is descended from the given FeatureType. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final FeatureType EMPTY
Constructor Detail |
public DefaultFeatureType(java.lang.String typeName, java.lang.String namespace, java.util.Collection types, java.util.Collection superTypes, GeometryAttributeType defaultGeom) throws SchemaException, java.lang.NullPointerException
public DefaultFeatureType(java.lang.String typeName, java.net.URI namespace, java.util.Collection types, java.util.Collection superTypes, GeometryAttributeType defaultGeom) throws java.lang.NullPointerException
Attributes from the superTypes will be copied to the list of attributes for this feature type.
typeName
- The name to give this FeatureType.namespace
- The namespace of the new FeatureType.types
- The attributeTypes to use for validation.superTypes
- The ancestors of this FeatureType.defaultGeom
- The attributeType to set as the defaultGeometry.
SchemaException
- For problems making the FeatureType.
java.lang.NullPointerException
- If typeName is null.Method Detail |
public Feature create(java.lang.Object[] attributes) throws IllegalAttributeException
create
in interface FeatureType
attributes
- the array of attribute values
IllegalAttributeException
- if this FeatureType does not validate
the attributes.public Feature create(java.lang.Object[] attributes, java.lang.String featureID) throws IllegalAttributeException
create
in interface FeatureType
attributes
- the array of attribute values.featureID
- the feature ID.
IllegalAttributeException
- if this FeatureType does not validate
the attributes.public Feature duplicate(Feature original) throws IllegalAttributeException
FeatureType
The implementation is assumed to make use of AttributeType duplicate as required for a deep copy.
//@deprecated This method will be removed in 2.2, please use FeatureFactory obtained from FactoryFinder
duplicate
in interface FeatureType
original
-
IllegalAttributeException
public GeometryAttributeType getDefaultGeometry()
getDefaultGeometry
in interface FeatureType
public AttributeType getAttributeType(java.lang.String xPath)
getAttributeType
in interface FeatureType
xPath
- XPath pointer to attribute type.
public int find(AttributeType type)
find
in interface FeatureType
type
- The type to search for.
public int find(java.lang.String attName)
find
in interface FeatureType
attName
- the name to look for
public AttributeType getAttributeType(int position)
getAttributeType
in interface FeatureType
position
- the position of the attribute to check.
public AttributeType[] getAttributeTypes()
FeatureType
The provided array of AttributeTypes should be considered as adding to (or overriding) the the AttribtueTypes defined by this FeatureTypes ancestors.
Note Well: Client code should not consider the index provided by the find( attName ) method as a valid index into the returned array.
getAttributeTypes
in interface FeatureType
public java.net.URI getNamespace()
getNamespace
in interface FeatureType
public java.lang.String getTypeName()
getTypeName
in interface FeatureType
public boolean hasAttributeType(java.lang.String xPath)
hasAttributeType
in interface FeatureType
xPath
- XPath pointer to attribute type.
public int getAttributeCount()
getAttributeCount
in interface FeatureType
public boolean equals(FeatureType other)
public int hashCode()
FeatureType
Hascode is always a matched set with an equals implementation, please see the javadocs for equals for a detailed discussion.
hashCode
in interface FeatureType
public java.lang.String toString()
public boolean equals(java.lang.Object other)
FeatureType
Conceptually FeatureType equality is supped to indicate an exact match based AttributeType and Ancestors. The geotools models includes additional information of namespace and typename.
As far as the geotools data model is concerned any FeatureType implementation should be able to be subsituted for another. (An actually application may provided an implementation that provdes tracking of metadata such as creation history, or support for additional interfaces).
Required implementation:
A sample implementation is provided in FeatureTypes.equals( FeatureType, FeatureType ).
Questions:
Q: You may wonder why namespace and typeName are not enought?
A: Geotools often returns a "limitied" schema in response to a query where only a subset
of the attributes are requested.
Q: Doesn't that still indicate the same schema?
A: Yes it kind of should, a GML application (such as GeoServer) has to actually follow the
application schema and include attributes required by the schema (but not request by the query).
This library is more lax in its treatment, and expects you to uses isDecendedFrom as required.
equals
in interface FeatureType
public FeatureType[] getAncestors()
getAncestors
in interface FeatureType
public boolean isAbstract()
isAbstract
in interface FeatureType
public boolean isDescendedFrom(FeatureType type)
FeatureType f1; FeatureType f2;
f1.isDescendedFrom(f2.getNamespace(),f2.getName());
isDescendedFrom
in interface FeatureType
type
- The type to compare to.
public boolean isDescendedFrom(java.net.URI nsURI, java.lang.String typeName1)
isDescendedFrom
in interface FeatureType
nsURI
- The namespace URI to use.typeName1
- The typeName.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |