public class AttributeTypeBuilder extends Object
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.
Modifier and Type | Field and Description |
---|---|
protected Class<?> |
binding
bound java class
|
protected CoordinateReferenceSystem |
crs |
protected Object |
defaultValue
default value
|
protected String |
description
string description
|
protected FeatureTypeFactory |
factory
factory
|
protected FilterFactory |
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 Integer |
length
If this value is set an additional restriction will be added based on the length function.
|
protected Integer |
maxOccurs
Maximum number of occurrences allowed.
|
protected Integer |
minOccurs
Minimum number of occurrences allowed.
|
protected String |
name
Local name used to name a descriptor; or combined with namespaceURI to name a type.
|
protected String |
namespaceURI
namespace used to distingish between otherwise identical type names.
|
protected List<Filter> |
restrictions
restrictions
|
protected AttributeType |
superType
super type
|
protected Map<Object,Object> |
userData
User data for the attribute.
|
Constructor and Description |
---|
AttributeTypeBuilder()
Constructs the builder.
|
AttributeTypeBuilder(FeatureTypeFactory factory)
Constructs the builder specifying the factory used to build attribute types.
|
Modifier and Type | Method and Description |
---|---|
AttributeTypeBuilder |
abstrct(boolean isAbstract) |
void |
addRestriction(Filter restriction) |
void |
addUserData(Object key,
Object value) |
AttributeTypeBuilder |
binding(Class<?> binding) |
AttributeDescriptor |
buildDescriptor(Name name,
AttributeType type) |
GeometryDescriptor |
buildDescriptor(Name name,
GeometryType type) |
AttributeDescriptor |
buildDescriptor(String name)
Builds an attribute descriptor first building an attribute type from internal state.
|
AttributeDescriptor |
buildDescriptor(String name,
AttributeType type)
Builds an attribute descriptor specifying its attribute type.
|
GeometryDescriptor |
buildDescriptor(String name,
GeometryType type)
Builds a geometry descriptor specifying its attribute type.
|
GeometryType |
buildGeometryType()
Builds the geometry attribute type.
|
AttributeType |
buildType()
Builds the attribute type.
|
AttributeTypeBuilder |
crs(CoordinateReferenceSystem crs) |
AttributeTypeBuilder |
defaultValue(Object defaultValue) |
AttributeTypeBuilder |
description(String description) |
AttributeTypeBuilder |
identifiable(boolean isIdentifiable) |
protected void |
init()
Resets all internal state.
|
void |
init(AttributeDescriptor descriptor)
Initializes builder state from another attribute descriptor.
|
AttributeTypeBuilder |
init(AttributeType type)
Initializes builder state from another attribute type.
|
boolean |
isCRSSet() |
AttributeTypeBuilder |
length(int length) |
protected Filter |
lengthRestriction(int length)
Helper method to create a "length" filter.
|
AttributeTypeBuilder |
maxOccurs(int maxOccurs) |
AttributeTypeBuilder |
minOccurs(int minOccurs) |
AttributeTypeBuilder |
name(String name) |
AttributeTypeBuilder |
namespaceURI(String namespaceURI) |
AttributeTypeBuilder |
nillable(boolean isNillable) |
protected void |
resetDescriptorState() |
protected void |
resetTypeState()
Resets all builder state used to build the attribute type.
|
AttributeTypeBuilder |
restriction(Filter restriction) |
protected List<Filter> |
restrictions() |
void |
setAbstract(boolean isAbstract) |
void |
setBinding(Class<?> binding) |
void |
setCRS(CoordinateReferenceSystem crs) |
void |
setDefaultValue(Object defaultValue) |
void |
setDescription(String description) |
AttributeTypeBuilder |
setFactory(FeatureTypeFactory factory) |
void |
setIdentifiable(boolean isIdentifiable) |
void |
setLength(int length) |
void |
setMaxOccurs(int maxOccurs) |
void |
setMinOccurs(int minOccurs) |
void |
setName(String name) |
void |
setNamespaceURI(String namespaceURI) |
void |
setNillable(boolean isNillable) |
protected String |
typeName() |
AttributeTypeBuilder |
userData(Object key,
Object value) |
protected FeatureTypeFactory factory
protected String name
protected String namespaceURI
protected boolean isAbstract
protected String description
protected boolean isIdentifiable
protected Class<?> binding
protected AttributeType superType
protected Object defaultValue
protected boolean isDefaultValueSet
protected CoordinateReferenceSystem crs
protected boolean isCrsSet
protected Integer minOccurs
protected Integer maxOccurs
protected boolean isNillable
Depending on this value minOccurs, maxOccurs and defaultValue() will return different results.
The default value is true
.
protected Integer length
protected FilterFactory ff
public AttributeTypeBuilder()
public AttributeTypeBuilder(FeatureTypeFactory factory)
protected void init()
protected void resetTypeState()
This method is called automatically after buildType()
and buildGeometryType()
.
protected void resetDescriptorState()
public AttributeTypeBuilder setFactory(FeatureTypeFactory factory)
public AttributeTypeBuilder init(AttributeType type)
public void init(AttributeDescriptor descriptor)
public void setBinding(Class<?> binding)
public void setName(String name)
public void setNamespaceURI(String namespaceURI)
public void setCRS(CoordinateReferenceSystem crs)
public boolean isCRSSet()
public void setDescription(String description)
public void setAbstract(boolean isAbstract)
public void setIdentifiable(boolean isIdentifiable)
public void setLength(int length)
public void addRestriction(Filter restriction)
public void setNillable(boolean isNillable)
public void setMaxOccurs(int maxOccurs)
public void setMinOccurs(int minOccurs)
public void setDefaultValue(Object defaultValue)
public AttributeTypeBuilder binding(Class<?> binding)
public AttributeTypeBuilder name(String name)
public AttributeTypeBuilder namespaceURI(String namespaceURI)
public AttributeTypeBuilder crs(CoordinateReferenceSystem crs)
public AttributeTypeBuilder description(String description)
public AttributeTypeBuilder abstrct(boolean isAbstract)
public AttributeTypeBuilder identifiable(boolean isIdentifiable)
public AttributeTypeBuilder length(int length)
public AttributeTypeBuilder restriction(Filter restriction)
public AttributeTypeBuilder nillable(boolean isNillable)
public AttributeTypeBuilder maxOccurs(int maxOccurs)
public AttributeTypeBuilder minOccurs(int minOccurs)
public AttributeTypeBuilder defaultValue(Object defaultValue)
public AttributeTypeBuilder userData(Object key, Object value)
public AttributeType buildType()
This method resets all state after the attribute is built.
protected String typeName()
public GeometryType buildGeometryType()
This method resets all state after the attribute is built.
public AttributeDescriptor buildDescriptor(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 AttributeDescriptor buildDescriptor(String name, 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 GeometryDescriptor buildDescriptor(String name, 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 AttributeDescriptor buildDescriptor(Name name, AttributeType type)
public GeometryDescriptor buildDescriptor(Name name, GeometryType type)
protected Filter lengthRestriction(int length)
Copyright © 1996–2019 Geotools. All rights reserved.