|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.data.DataUtilities
Utility functions for use when implementing working with data classes.
Nested Class Summary | |
static class |
DataUtilities.AbstractFilterVisitor
A quick and dirty FilterVisitor. |
static class |
DataUtilities.Traversal
|
Constructor Summary | |
DataUtilities()
|
Method Summary | |
static java.lang.String[] |
attributeNames(FeatureType featureType)
|
static java.lang.String[] |
attributeNames(Filter filter)
|
static boolean |
attributesEqual(java.lang.Object att,
java.lang.Object otherAtt)
|
static FeatureCollection |
collection(Feature[] features)
|
static int |
compare(FeatureType typeA,
FeatureType typeB)
Compare operation for FeatureType. |
static FeatureType |
createSubType(FeatureType featureType,
java.lang.String[] properties)
|
static FeatureType |
createSubType(FeatureType featureType,
java.lang.String[] properties,
org.geotools.cs.CoordinateSystem override)
|
static FeatureType |
createType(java.lang.String identification,
java.lang.String typeSpec)
Utility method for FeatureType construction. |
static java.lang.Object |
defaultValue(AttributeType attributeType)
Provides a defautlValue for attributeType. |
static java.lang.Object[] |
defaultValues(FeatureType featureType)
|
static java.lang.Object[] |
defaultValues(FeatureType featureType,
java.lang.Object[] values)
|
static boolean |
isMatch(AttributeType a,
AttributeType b)
|
static Feature |
parse(FeatureType type,
java.lang.String fid,
java.lang.String[] text)
|
static FeatureReader |
reader(java.util.Collection collection)
|
static FeatureReader |
reader(Feature[] features)
Creates a FeatureReader for testing. |
static FeatureResults |
results(Feature[] featureArray)
|
static FeatureResults |
results(FeatureCollection collection)
|
static Feature |
reType(FeatureType featureType,
Feature feature)
Creates duplicate of feature adjusted to the provided featureType. |
static FeatureSource |
source(Feature[] featureArray)
|
static FeatureSource |
source(FeatureCollection collection)
|
static java.lang.String |
spec(FeatureType featureType)
Record typeSpec for the provided featureType |
static Feature |
template(FeatureType featureType)
Constructs an empty feature to use as a Template for new content. |
static Feature |
template(FeatureType featureType,
java.lang.Object[] atts)
|
static Feature |
template(FeatureType featureType,
java.lang.String featureID)
|
static Feature |
template(FeatureType featureType,
java.lang.String featureID,
java.lang.Object[] atts)
|
static void |
traverse(Filter filter,
FilterVisitor visitor)
|
static void |
traverse(java.util.Set set,
FilterVisitor visitor)
Performs a depth first traversal on Filter. |
static java.util.Set |
traverseDepth(Filter filter)
Performs a depth first traversal of Filter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DataUtilities()
Method Detail |
public static java.lang.String[] attributeNames(FeatureType featureType)
public static java.lang.String[] attributeNames(Filter filter)
public static void traverse(Filter filter, FilterVisitor visitor)
public static void traverse(java.util.Set set, FilterVisitor visitor)
Filters can contain Expressions and other Filters, this method will call visitor.visit( Filter ) and visitor.visit( Expression )
set
- Set of Filter and Expression informationvisitor
- Vistor to traverse across setpublic static java.util.Set traverseDepth(Filter filter)
filter
-
public static int compare(FeatureType typeA, FeatureType typeB)
Results in:
Comparison is based on AttributeTypes, an IOException is thrown if the AttributeTypes are not compatiable.
Namespace is not considered in this opperations. You may still need to reType to get the correct namesapce, or reorder.
typeA
- FeatureType beind comparedtypeB
- FeatureType being compared against
public static boolean isMatch(AttributeType a, AttributeType b)
public static Feature reType(FeatureType featureType, Feature feature) throws IllegalAttributeException
featureType
- FeatureType requestedfeature
- Origional Feature from DataStore
IllegalAttributeException
- If opperation could not be performedpublic static Feature template(FeatureType featureType) throws IllegalAttributeException
We may move this functionality to FeatureType.create( null )?
featureType
- Type of feature we wish to create
IllegalAttributeException
- if we could not create featureType
instance with acceptable default valuespublic static Feature template(FeatureType featureType, java.lang.String featureID) throws IllegalAttributeException
IllegalAttributeException
public static java.lang.Object[] defaultValues(FeatureType featureType) throws IllegalAttributeException
IllegalAttributeException
public static Feature template(FeatureType featureType, java.lang.Object[] atts) throws IllegalAttributeException
IllegalAttributeException
public static Feature template(FeatureType featureType, java.lang.String featureID, java.lang.Object[] atts) throws IllegalAttributeException
IllegalAttributeException
public static java.lang.Object[] defaultValues(FeatureType featureType, java.lang.Object[] values) throws IllegalAttributeException
IllegalAttributeException
public static java.lang.Object defaultValue(AttributeType attributeType) throws IllegalAttributeException
Will return null if attributeType isNillable(), or attempt to use Reflection, or attributeType.parse( null )
attributeType
-
IllegalAttributeException
- If value cannot be constructed for
attribtueTypepublic static FeatureReader reader(Feature[] features) throws java.io.IOException
features
- Array of features
java.io.IOException
- If provided features Are null or emptypublic static FeatureSource source(Feature[] featureArray) throws java.io.IOException
java.io.IOException
public static FeatureSource source(FeatureCollection collection) throws java.io.IOException
java.io.IOException
public static FeatureResults results(Feature[] featureArray) throws java.io.IOException
java.io.IOException
public static FeatureResults results(FeatureCollection collection) throws java.io.IOException
java.io.IOException
public static FeatureReader reader(java.util.Collection collection) throws java.io.IOException
java.io.IOException
public static FeatureCollection collection(Feature[] features)
public static boolean attributesEqual(java.lang.Object att, java.lang.Object otherAtt)
public static FeatureType createSubType(FeatureType featureType, java.lang.String[] properties, org.geotools.cs.CoordinateSystem override) throws SchemaException
SchemaException
public static FeatureType createSubType(FeatureType featureType, java.lang.String[] properties) throws SchemaException
SchemaException
public static FeatureType createType(java.lang.String identification, java.lang.String typeSpec) throws SchemaException
Will parse a String of the form: "name:Type,name2:Type2,..."
Where Type is defined by createAttribute.
You may indicate the default Geometry with an astrix.
Example:name:"",age:0,geom:Geometry,centroid:Point,url:java.io.URL"
identification
- identification of FeatureType:
(namesapce).typeNametypeSpec
- Specification for FeatureType
SchemaException
public static Feature parse(FeatureType type, java.lang.String fid, java.lang.String[] text) throws IllegalAttributeException
IllegalAttributeException
public static java.lang.String spec(FeatureType featureType)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |