|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.feature.AttributeTypeBuilder
public class AttributeTypeBuilder
Builder for attribute types and descriptors.
Building an attribute type:
//create the builder
AttributeTypeBuilder builder = new AttributeTypeBuilder();
//set type information
builder.setName( "intType" ):
builder.setBinding( Integer.class );
builder.setNillable( false );
//build the type
AttributeType type = builder.buildType();
Building an attribute descriptor:
//create the builder
AttributeTypeBuilder builder = new AttributeTypeBuilder();
//set type information
builder.setName( "intType" ):
builder.setBinding( Integer.class );
builder.setNillable( false );
//set descriptor information
builder.setMinOccurs(0);
builder.setMaxOccurs(1);
builder.setNillable(true);
//build the descriptor
AttributeDescriptor descriptor = builder.buildDescriptor("intProperty");
This class maintains state and is not thread safe.
Field Summary | |
---|---|
protected java.lang.Class |
binding
bound java class |
protected org.opengis.referencing.crs.CoordinateReferenceSystem |
crs
|
protected java.lang.Object |
defaultValue
default value |
protected java.lang.String |
description
string description |
protected org.opengis.feature.type.FeatureTypeFactory |
factory
factory |
protected org.opengis.filter.FilterFactory2 |
ff
filter factory |
protected boolean |
isAbstract
abstract flag |
protected boolean |
isCrsSet
|
protected boolean |
isDefaultValueSet
|
protected boolean |
isIdentifiable
identifiable flag |
protected boolean |
isNillable
True if value is allowed to be null. |
protected java.lang.Integer |
length
If this value is set an additional restriction will be added based on the length function. |
protected java.lang.Integer |
maxOccurs
Maximum number of occurrences allowed. |
protected java.lang.Integer |
minOccurs
Minimum number of occurrences allowed. |
protected java.lang.String |
name
Local name used to name a descriptor; or combined with namespaceURI to name a type. |
protected java.lang.String |
namespaceURI
namespace used to distingish between otherwise identical type names. |
protected java.util.List<org.opengis.filter.Filter> |
restrictions
restrictions |
protected org.opengis.feature.type.AttributeType |
superType
super type |
protected java.util.Map |
userData
User data for the attribute. |
Constructor Summary | |
---|---|
AttributeTypeBuilder()
Constructs the builder. |
|
AttributeTypeBuilder(org.opengis.feature.type.FeatureTypeFactory factory)
Constructs the builder specifying the factory used to build attribute types. |
Method Summary | |
---|---|
AttributeTypeBuilder |
abstrct(boolean isAbstract)
|
void |
addRestriction(org.opengis.filter.Filter restriction)
|
void |
addUserData(java.lang.Object key,
java.lang.Object value)
|
AttributeTypeBuilder |
binding(java.lang.Class binding)
|
org.opengis.feature.type.AttributeDescriptor |
buildDescriptor(org.opengis.feature.type.Name name,
org.opengis.feature.type.AttributeType type)
|
org.opengis.feature.type.GeometryDescriptor |
buildDescriptor(org.opengis.feature.type.Name name,
org.opengis.feature.type.GeometryType type)
|
org.opengis.feature.type.AttributeDescriptor |
buildDescriptor(java.lang.String name)
Builds an attribute descriptor first building an attribute type from internal state. |
org.opengis.feature.type.AttributeDescriptor |
buildDescriptor(java.lang.String name,
org.opengis.feature.type.AttributeType type)
Builds an attribute descriptor specifying its attribute type. |
org.opengis.feature.type.GeometryDescriptor |
buildDescriptor(java.lang.String name,
org.opengis.feature.type.GeometryType type)
Builds a geometry descriptor specifying its attribute type. |
org.opengis.feature.type.GeometryType |
buildGeometryType()
Builds the geometry attribute type. |
org.opengis.feature.type.AttributeType |
buildType()
Builds the attribute type. |
AttributeTypeBuilder |
crs(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
|
AttributeTypeBuilder |
defaultValue(java.lang.Object defaultValue)
|
AttributeTypeBuilder |
description(java.lang.String description)
|
AttributeTypeBuilder |
identifiable(boolean isIdentifiable)
|
protected void |
init()
Resets all internal state. |
void |
init(org.opengis.feature.type.AttributeDescriptor descriptor)
Initializes builder state from another attribute descriptor. |
AttributeTypeBuilder |
init(org.opengis.feature.type.AttributeType type)
Initializes builder state from another attribute type. |
boolean |
isCRSSet()
|
AttributeTypeBuilder |
length(int length)
|
protected org.opengis.filter.Filter |
lengthRestriction(int length)
Helper method to create a "length" filter. |
AttributeTypeBuilder |
maxOccurs(int maxOccurs)
|
AttributeTypeBuilder |
minOccurs(int minOccurs)
|
AttributeTypeBuilder |
name(java.lang.String name)
|
AttributeTypeBuilder |
namespaceURI(java.lang.String namespaceURI)
|
AttributeTypeBuilder |
nillable(boolean isNillable)
|
protected void |
resetDescriptorState()
|
protected void |
resetTypeState()
Resets all builder state used to build the attribute type. |
AttributeTypeBuilder |
restriction(org.opengis.filter.Filter restriction)
|
protected java.util.List<org.opengis.filter.Filter> |
restrictions()
|
void |
setAbstract(boolean isAbstract)
|
void |
setBinding(java.lang.Class binding)
|
void |
setCRS(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
|
void |
setDefaultValue(java.lang.Object defaultValue)
|
void |
setDescription(java.lang.String description)
|
AttributeTypeBuilder |
setFactory(org.opengis.feature.type.FeatureTypeFactory factory)
|
void |
setIdentifiable(boolean isIdentifiable)
|
void |
setLength(int length)
|
void |
setMaxOccurs(int maxOccurs)
|
void |
setMinOccurs(int minOccurs)
|
void |
setName(java.lang.String name)
|
void |
setNamespaceURI(java.lang.String namespaceURI)
|
void |
setNillable(boolean isNillable)
|
protected java.lang.String |
typeName()
|
AttributeTypeBuilder |
userData(java.lang.Object key,
java.lang.Object value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.opengis.feature.type.FeatureTypeFactory factory
protected java.lang.String name
protected java.lang.String namespaceURI
protected boolean isAbstract
protected java.util.List<org.opengis.filter.Filter> restrictions
protected java.lang.String description
protected boolean isIdentifiable
protected java.lang.Class binding
protected org.opengis.feature.type.AttributeType superType
protected java.lang.Object defaultValue
protected boolean isDefaultValueSet
protected org.opengis.referencing.crs.CoordinateReferenceSystem crs
protected boolean isCrsSet
protected java.lang.Integer minOccurs
protected java.lang.Integer maxOccurs
protected boolean isNillable
Depending on this value minOccurs, maxOccurs and defaultValue() will return different results.
The default value is true
.
protected java.lang.Integer length
protected java.util.Map userData
protected org.opengis.filter.FilterFactory2 ff
Constructor Detail |
---|
public AttributeTypeBuilder()
public AttributeTypeBuilder(org.opengis.feature.type.FeatureTypeFactory factory)
Method Detail |
---|
protected void init()
protected void resetTypeState()
This method is called automatically after buildType()
and
buildGeometryType()
.
protected void resetDescriptorState()
public AttributeTypeBuilder setFactory(org.opengis.feature.type.FeatureTypeFactory factory)
public AttributeTypeBuilder init(org.opengis.feature.type.AttributeType type)
public void init(org.opengis.feature.type.AttributeDescriptor descriptor)
public void setBinding(java.lang.Class binding)
public void setName(java.lang.String name)
public void setNamespaceURI(java.lang.String namespaceURI)
public void setCRS(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
public boolean isCRSSet()
public void setDescription(java.lang.String description)
public void setAbstract(boolean isAbstract)
public void setIdentifiable(boolean isIdentifiable)
public void setLength(int length)
public void addRestriction(org.opengis.filter.Filter restriction)
public void addUserData(java.lang.Object key, java.lang.Object value)
public void setNillable(boolean isNillable)
public void setMaxOccurs(int maxOccurs)
public void setMinOccurs(int minOccurs)
public void setDefaultValue(java.lang.Object defaultValue)
public AttributeTypeBuilder binding(java.lang.Class binding)
public AttributeTypeBuilder name(java.lang.String name)
public AttributeTypeBuilder namespaceURI(java.lang.String namespaceURI)
public AttributeTypeBuilder crs(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
public AttributeTypeBuilder description(java.lang.String description)
public AttributeTypeBuilder abstrct(boolean isAbstract)
public AttributeTypeBuilder identifiable(boolean isIdentifiable)
public AttributeTypeBuilder length(int length)
public AttributeTypeBuilder restriction(org.opengis.filter.Filter restriction)
public AttributeTypeBuilder nillable(boolean isNillable)
public AttributeTypeBuilder maxOccurs(int maxOccurs)
public AttributeTypeBuilder minOccurs(int minOccurs)
public AttributeTypeBuilder defaultValue(java.lang.Object defaultValue)
public AttributeTypeBuilder userData(java.lang.Object key, java.lang.Object value)
public org.opengis.feature.type.AttributeType buildType()
This method resets all state after the attribute is built.
protected java.lang.String typeName()
public org.opengis.feature.type.GeometryType buildGeometryType()
This method resets all state after the attribute is built.
public org.opengis.feature.type.AttributeDescriptor buildDescriptor(java.lang.String name)
If crs
has been set via setCRS(CoordinateReferenceSystem)
the internal attribute type will be built via buildGeometryType()
,
otherwise it will be built via buildType()
.
This method calls through to buildDescriptor(String, AttributeType)
.
name
- The name of the descriptor.buildDescriptor(String, AttributeType)
public org.opengis.feature.type.AttributeDescriptor buildDescriptor(java.lang.String name, org.opengis.feature.type.AttributeType type)
Internal state is reset after the descriptor is built.
name
- The name of the descriptor.type
- The type referenced by the descriptor.public org.opengis.feature.type.GeometryDescriptor buildDescriptor(java.lang.String name, org.opengis.feature.type.GeometryType type)
Internal state is reset after the descriptor is built.
name
- The name of the descriptor.type
- The geometry type referenced by the descriptor.public org.opengis.feature.type.AttributeDescriptor buildDescriptor(org.opengis.feature.type.Name name, org.opengis.feature.type.AttributeType type)
public org.opengis.feature.type.GeometryDescriptor buildDescriptor(org.opengis.feature.type.Name name, org.opengis.feature.type.GeometryType type)
protected java.util.List<org.opengis.filter.Filter> restrictions()
protected org.opengis.filter.Filter lengthRestriction(int length)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |