|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.feature.FeatureTypes org.geotools.feature.FeatureTypeBuilder
A schema builder, because FeatureTypes are meant to be immutable, this object is mutable.
The basic idea for usage is that you configure the builder to whatever state
is desired, setting properties and adding AttributeTypes. When the desired
state is acheived, the expected FeatureType can be retrieved by calling
getFeatureType()
Repeated calls to getFeatureType will return the same FeatureType given that no calls which modify the state of the factory are made.
Here's an example of how to use this:
There are also a set of convenience methods for creation of FeatureTypes.
These are the various newFeatureType methods.
FeatureTypeBuilder build = FeatureTypeFactory.newInstance();
build.addType(...);
build.setName(...);
build.setNamespace(...);
FeatureType type = build.getFeatureType();
Field Summary |
Fields inherited from class org.geotools.feature.FeatureTypes |
ANY_LENGTH |
Constructor Summary | |
FeatureTypeBuilder()
An empty public constructor. |
|
FeatureTypeBuilder(java.util.Map hints)
An empty public constructor. |
Method Summary | |
protected abstract void |
add(AttributeType type)
DOCUMENT ME! |
protected abstract void |
add(int idx,
AttributeType type)
DOCUMENT ME! |
protected void |
addBaseTypes(java.util.Set types)
|
void |
addType(AttributeType type)
A the given AttributeType to this factory. |
void |
addType(int idx,
AttributeType type)
Insert the given type at the index specified. |
void |
addTypes(AttributeType[] types)
Add an array of AttributeTypes to this factory. |
protected void |
check(AttributeType type)
Checks to see if this factory already contains the type. |
boolean |
contains(AttributeType type)
Check to see if this factory contains the given AttributeType. |
protected abstract FeatureType |
createFeatureType()
DOCUMENT ME! |
abstract AttributeType |
get(int idx)
DOCUMENT ME! |
abstract int |
getAttributeCount()
DOCUMENT ME! |
protected java.util.Set |
getBuiltinTypes()
|
GeometryAttributeType |
getDefaultGeometry()
Return the AttributeType currently used as the defaultGeometry property for the FeatureType this factory will create. |
FeatureType |
getFeatureType()
Get a FeatureType which reflects the state of this factory. |
java.util.Map |
getImplementationHints()
Returns the implementation hints. |
java.lang.String |
getName()
Get the current configuration of the name of this factory. |
java.net.URI |
getNamespace()
Get the current configuration of the namespace of this factory. |
java.util.Collection |
getSuperTypes()
Obtain the super types of this factory. |
void |
importType(FeatureType type)
A convienence method for importing AttributeTypes, simply calls importType(type,false) |
void |
importType(FeatureType type,
boolean strict)
Import all of the AttributeTypes from the given FeatureType into this factory. |
boolean |
isAbstract()
Is this factory configured to be abstract? |
static FeatureTypeFactory |
newInstance(java.lang.String name)
Create a new FeatureTypeFactory with the given typeName. |
protected abstract AttributeType |
remove(AttributeType type)
DOCUMENT ME! |
protected abstract AttributeType |
remove(int idx)
DOCUMENT ME! |
void |
removeAll()
Remove all the AttributeTypes in this factory. |
void |
removeType(AttributeType type)
Remove the given type from this factory. |
void |
removeType(int idx)
Remove the AttributeType at the given index. |
protected abstract AttributeType |
set(int idx,
AttributeType type)
DOCUMENT ME! |
void |
setAbstract(boolean a)
Configure this factory to produce an abstract type. |
void |
setDefaultGeometry(GeometryAttributeType defaultGeometry)
Sets the defaultGeometry of this factory. |
void |
setName(java.lang.String name)
Set the name of the FeatureType this factory will produce. |
void |
setNamespace(java.net.URI namespace)
Set the namespace of the FeatureType this factory will produce. |
void |
setSuperTypes(java.util.Collection types)
Set the super types of this factory. |
void |
setType(int idx,
AttributeType type)
Set the AttributeType at the given index. |
void |
swap(int idx1,
int idx2)
Swap the AttributeTypes at the given locations. |
java.lang.String |
toString()
Returns a string representation of this factory. |
Methods inherited from class org.geotools.feature.FeatureTypes |
ancestors, equals, equals, equals, equalsAncestors, equalsId, getFieldLength, isDecendedFrom, isDecendedFrom, newFeatureType, newFeatureType, newFeatureType, newFeatureType, newFeatureType, newFeatureType, transform, transform |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public FeatureTypeBuilder()
public FeatureTypeBuilder(java.util.Map hints)
Method Detail |
public java.util.Map getImplementationHints()
Since the building of a FeatureType involves the collaboration of may Factory classes (that may be discovered over the course of the build process) we are forced to indicate that *all* hints are used.
Strictly this is a Builder (not a factory) and has no need declair which hints are used (as one can never *keep* this builder in a factory registery. (It is stateful and cannot be used concurrently for example).
getImplementationHints
in interface Factory
public static FeatureTypeFactory newInstance(java.lang.String name) throws FactoryConfigurationError
name
- The typeName of the feature to create.
FactoryConfigurationError
- If there exists a configuration error.public void importType(FeatureType type, boolean strict) throws java.lang.IllegalArgumentException
If strict is true, non-uniquely named AttributeTypes will throw an exception.
If strict is false, these will be silently ignored, but not added.
No other information is imported.
type
- The FeatureType to import from.strict
- Enforce namespace restrictions.
java.lang.IllegalArgumentException
- If strict is true and there are naming
problems.public final void setSuperTypes(java.util.Collection types)
types
- A Collection of types.public final java.util.Collection getSuperTypes()
public void importType(FeatureType type)
importType(type,false)
type
- The type to import.public void setName(java.lang.String name)
name
- The new name. May be null.public final java.lang.String getName()
public void setNamespace(java.net.URI namespace)
namespace
- The new namespace. May be null.public final java.net.URI getNamespace()
public final boolean isAbstract()
public final void setAbstract(boolean a)
a
- True or false.public final void removeAll()
public final void addTypes(AttributeType[] types) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
types
- The types or a null array.
java.lang.NullPointerException
- If any of the types are null.
java.lang.IllegalArgumentException
- If there are naming problems.public final void addType(AttributeType type) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
type
- The type to add.
java.lang.NullPointerException
- If the type is null.
java.lang.IllegalArgumentException
- If another type exists with the same
name.public final void removeType(AttributeType type) throws java.lang.NullPointerException
type
- The type to remove.
java.lang.NullPointerException
- If the type is null.public final void addType(int idx, AttributeType type) throws java.lang.NullPointerException, java.lang.IllegalArgumentException, java.lang.ArrayIndexOutOfBoundsException
idx
- The index to insert at.type
- The AttributeType to insert.
java.lang.NullPointerException
- If the type is null.
java.lang.IllegalArgumentException
- If the AttributeType is not allowed.
java.lang.ArrayIndexOutOfBoundsException
- If the index is out of range.public final void removeType(int idx) throws java.lang.ArrayIndexOutOfBoundsException
idx
- The index to remove at.
java.lang.ArrayIndexOutOfBoundsException
- If the index is out of bounds.public final void setType(int idx, AttributeType type) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, java.lang.ArrayIndexOutOfBoundsException
idx
- The index to use.type
- The type to use.
java.lang.IllegalArgumentException
- If the type is not good.
java.lang.NullPointerException
- if they type passed in is null
java.lang.ArrayIndexOutOfBoundsException
- if the index is out of bounds.public final void swap(int idx1, int idx2) throws java.lang.ArrayIndexOutOfBoundsException
idx1
- The index of the first.idx2
- The index of the second.
java.lang.ArrayIndexOutOfBoundsException
- if either index is not in the
array bounds.public final GeometryAttributeType getDefaultGeometry()
public final void setDefaultGeometry(GeometryAttributeType defaultGeometry) throws java.lang.IllegalArgumentException
defaultGeometry
- The AttributeType to use as the defaultGeometry.
May be null.
java.lang.IllegalArgumentException
- if the type is not a geometry.public final FeatureType getFeatureType() throws SchemaException
SchemaException
- if name is null or blankpublic java.lang.String toString()
public final boolean contains(AttributeType type)
type
- The AttributeType to search for by name.
protected void check(AttributeType type)
type
-
java.lang.IllegalArgumentException
- DOCUMENT ME!protected final java.util.Set getBuiltinTypes()
protected void addBaseTypes(java.util.Set types)
protected abstract FeatureType createFeatureType() throws SchemaException
SchemaException
protected abstract void add(AttributeType type) throws java.lang.IllegalArgumentException
type
-
java.lang.IllegalArgumentException
protected abstract AttributeType remove(AttributeType type)
type
-
protected abstract void add(int idx, AttributeType type) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException
idx
- type
-
java.lang.ArrayIndexOutOfBoundsException
java.lang.IllegalArgumentException
protected abstract AttributeType remove(int idx) throws java.lang.ArrayIndexOutOfBoundsException
idx
-
java.lang.ArrayIndexOutOfBoundsException
public abstract AttributeType get(int idx) throws java.lang.ArrayIndexOutOfBoundsException
idx
-
java.lang.ArrayIndexOutOfBoundsException
protected abstract AttributeType set(int idx, AttributeType type) throws java.lang.ArrayIndexOutOfBoundsException, java.lang.IllegalArgumentException
idx
- type
-
java.lang.ArrayIndexOutOfBoundsException
java.lang.IllegalArgumentException
public abstract int getAttributeCount()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |