|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.data.DataUtilities
Utility functions for use when implementing working with data classes.
TODO: Move FeatureType manipulation to feature package
Nested Class Summary | |
static class |
DataUtilities.AbstractFilterVisitor
A quick and dirty FilterVisitor. |
static class |
DataUtilities.Traversal
DOCUMENT ME! |
Constructor Summary | |
DataUtilities()
|
Method Summary | |
static java.lang.String[] |
attributeNames(Expression expression)
DOCUMENT ME! |
static java.lang.String[] |
attributeNames(FeatureType featureType)
DOCUMENT ME! |
static java.lang.String[] |
attributeNames(Filter filter)
DOCUMENT ME! |
static boolean |
attributesEqual(java.lang.Object att,
java.lang.Object otherAtt)
DOCUMENT ME! |
static FeatureCollection |
collection(Feature[] features)
DOCUMENT ME! |
static int |
compare(FeatureType typeA,
FeatureType typeB)
Compare operation for FeatureType. |
static FeatureType |
createSubType(FeatureType featureType,
java.lang.String[] properties)
DOCUMENT ME! |
static FeatureType |
createSubType(FeatureType featureType,
java.lang.String[] properties,
org.opengis.referencing.crs.CoordinateReferenceSystem override)
Create a derived FeatureType |
static FeatureType |
createSubType(FeatureType featureType,
java.lang.String[] properties,
org.opengis.referencing.crs.CoordinateReferenceSystem override,
java.lang.String typeName,
java.net.URI namespace)
|
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)
DOCUMENT ME! |
static java.lang.Object[] |
defaultValues(FeatureType featureType,
java.lang.Object[] values)
DOCUMENT ME! |
static boolean |
isMatch(AttributeType a,
AttributeType b)
DOCUMENT ME! |
static Query |
mixQueries(Query firstQuery,
Query secondQuery,
java.lang.String handle)
Takes two Query objects and produce a new one by mixing the
restrictions of both of them.
|
static Feature |
parse(FeatureType type,
java.lang.String fid,
java.lang.String[] text)
DOCUMENT ME! |
static FeatureReader |
reader(java.util.Collection collection)
DOCUMENT ME! |
static FeatureReader |
reader(Feature[] features)
Creates a FeatureReader for testing. |
static FeatureResults |
results(Feature[] featureArray)
|
static FeatureResults |
results(FeatureCollection collection)
DOCUMENT ME! |
static Feature |
reType(FeatureType featureType,
Feature feature)
Creates duplicate of feature adjusted to the provided featureType. |
static FeatureSource |
source(Feature[] featureArray)
DOCUMENT ME! |
static FeatureSource |
source(FeatureCollection collection)
DOCUMENT ME! |
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)
DOCUMENT ME! |
static Feature |
template(FeatureType featureType,
java.lang.String featureID)
DOCUMENT ME! |
static Feature |
template(FeatureType featureType,
java.lang.String featureID,
java.lang.Object[] atts)
DOCUMENT ME! |
static void |
traverse(Expression expression,
FilterVisitor visitor)
|
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(Expression expression)
Performs a depth first traversal of 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)
featureType
- DOCUMENT ME!
public static java.lang.String[] attributeNames(Filter filter)
filter
- DOCUMENT ME!
public static java.lang.String[] attributeNames(Expression expression)
public static void traverse(Filter filter, FilterVisitor visitor)
filter
- DOCUMENT ME!visitor
- DOCUMENT ME!public static void traverse(Expression expression, FilterVisitor visitor)
visitor
- DOCUMENT ME!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 java.util.Set traverseDepth(Expression expression)
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)
a
- DOCUMENT ME!b
- DOCUMENT ME!
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
featureType
- DOCUMENT ME!featureID
- DOCUMENT ME!
IllegalAttributeException
- DOCUMENT ME!public static java.lang.Object[] defaultValues(FeatureType featureType) throws IllegalAttributeException
featureType
- DOCUMENT ME!
IllegalAttributeException
- DOCUMENT ME!public static Feature template(FeatureType featureType, java.lang.Object[] atts) throws IllegalAttributeException
featureType
- DOCUMENT ME!atts
- DOCUMENT ME!
IllegalAttributeException
- DOCUMENT ME!public static Feature template(FeatureType featureType, java.lang.String featureID, java.lang.Object[] atts) throws IllegalAttributeException
featureType
- DOCUMENT ME!featureID
- DOCUMENT ME!atts
- DOCUMENT ME!
IllegalAttributeException
- DOCUMENT ME!public static java.lang.Object[] defaultValues(FeatureType featureType, java.lang.Object[] values) throws IllegalAttributeException
featureType
- DOCUMENT ME!values
- DOCUMENT ME!
IllegalAttributeException
- DOCUMENT ME!
java.lang.ArrayIndexOutOfBoundsException
- DOCUMENT ME!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 empty
java.util.NoSuchElementException
- DOCUMENT ME!public static FeatureSource source(Feature[] featureArray)
featureArray
- DOCUMENT ME!
java.io.IOException
- DOCUMENT ME!
java.lang.RuntimeException
- DOCUMENT ME!public static FeatureSource source(FeatureCollection collection)
collection
- DOCUMENT ME!
java.lang.NullPointerException
- DOCUMENT ME!
java.lang.RuntimeException
- DOCUMENT ME!public static FeatureResults results(Feature[] featureArray) throws java.io.IOException
java.io.IOException
public static FeatureResults results(FeatureCollection collection) throws java.io.IOException
collection
- DOCUMENT ME!
java.io.IOException
- DOCUMENT ME!public static FeatureReader reader(java.util.Collection collection) throws java.io.IOException
collection
- DOCUMENT ME!
java.io.IOException
- DOCUMENT ME!public static FeatureCollection collection(Feature[] features)
features
- DOCUMENT ME!
public static boolean attributesEqual(java.lang.Object att, java.lang.Object otherAtt)
att
- DOCUMENT ME!otherAtt
- DOCUMENT ME!
public static FeatureType createSubType(FeatureType featureType, java.lang.String[] properties, org.opengis.referencing.crs.CoordinateReferenceSystem override) throws SchemaException
featureType
- properties
- - if null, every property of the feature type in input will be usedoverride
-
SchemaException
public static FeatureType createSubType(FeatureType featureType, java.lang.String[] properties, org.opengis.referencing.crs.CoordinateReferenceSystem override, java.lang.String typeName, java.net.URI namespace) throws SchemaException
SchemaException
public static FeatureType createSubType(FeatureType featureType, java.lang.String[] properties) throws SchemaException
featureType
- DOCUMENT ME!properties
- DOCUMENT ME!
SchemaException
- DOCUMENT ME!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: "*geom:Geometry".
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
type
- DOCUMENT ME!fid
- DOCUMENT ME!text
- DOCUMENT ME!
IllegalAttributeException
- DOCUMENT ME!public static java.lang.String spec(FeatureType featureType)
featureType
- DOCUMENT ME!
public static Query mixQueries(Query firstQuery, Query secondQuery, java.lang.String handle)
Query
objects and produce a new one by mixing the
restrictions of both of them.
The policy to mix the queries components is the following:
Query.ALL
)
retrieveAllProperties()
of some of the queries returns
true
it does not means that all the properties will be
joined. You must create the query with the names of the properties you
want to load.
firstQuery
- Query against this DataStoresecondQuery
- DOCUMENT ME!handle
- DOCUMENT ME!
java.lang.NullPointerException
- if some of the queries is null
java.lang.IllegalArgumentException
- if the type names of both queries do
not match
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |