Class AttributeTypeBuilder
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.
- Author:
- Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Class<?>bound java classprotected CoordinateReferenceSystemprotected Objectdefault valueprotected InternationalStringstring descriptionprotected FeatureTypeFactoryfactoryprotected FilterFactoryfilter factoryprotected booleanabstract flagprotected booleanprotected booleanprotected booleanidentifiable flagprotected booleanTrue if value is allowed to be null.protected IntegerIf this value is set an additional restriction will be added based on the length function.protected IntegerMaximum number of occurrences allowed.protected IntegerMinimum number of occurrences allowed.protected StringLocal name used to name a descriptor; or combined with namespaceURI to name a type.protected Stringnamespace used to distingish between otherwise identical type names.restrictionsprotected AttributeTypesuper typeUser data for the attribute. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs the builder.AttributeTypeBuilder(FeatureTypeFactory factory) Constructs the builder specifying the factory used to build attribute types. -
Method Summary
Modifier and TypeMethodDescriptionabstrct(boolean isAbstract) voidaddRestriction(Filter restriction) voidaddUserData(Object key, Object value) buildDescriptor(String name) Builds an attribute descriptor first building an attribute type from internal state.buildDescriptor(String name, AttributeType type) Builds an attribute descriptor specifying its attribute type.buildDescriptor(String name, GeometryType type) Builds a geometry descriptor specifying its attribute type.buildDescriptor(Name name, AttributeType type) buildDescriptor(Name name, GeometryType type) Builds the geometry attribute type.Builds the attribute type.defaultValue(Object defaultValue) description(String description) identifiable(boolean isIdentifiable) protected voidinit()Resets all internal state.voidinit(AttributeDescriptor descriptor) Initializes builder state from another attribute descriptor.init(AttributeType type) Initializes builder state from another attribute type.booleanisCRSSet()length(int length) protected FilterlengthRestriction(int length) Helper method to create a "length" filter.maxOccurs(int maxOccurs) minOccurs(int minOccurs) namespaceURI(String namespaceURI) nillable(boolean isNillable) Sets a list of possible valid values for the attribute type being built, and returns a reference to the builder itselfrange(NumberRange<? extends Number> range) Sets a range to which the attribute value should be contained in and returns a reference to the builder itselfprotected voidprotected voidResets all builder state used to build the attribute type.restriction(Filter restriction) voidsetAbstract(boolean isAbstract) voidsetBinding(Class<?> binding) voidvoidsetDefaultValue(Object defaultValue) voidsetDescription(String description) voidsetDescription(InternationalString description) setFactory(FeatureTypeFactory factory) voidsetIdentifiable(boolean isIdentifiable) voidsetLength(int length) voidsetMaxOccurs(int maxOccurs) voidsetMinOccurs(int minOccurs) voidvoidsetNamespaceURI(String namespaceURI) voidsetNillable(boolean isNillable) voidsetOptions(List<?> options) Sets a list of possible valid values for the attribute type being builtvoidsetRange(NumberRange<? extends Number> range) Sets a range to which the attribute value should be contained in.superType(AttributeType superType)
-
Field Details
-
factory
factory -
name
Local name used to name a descriptor; or combined with namespaceURI to name a type. -
namespaceURI
namespace used to distingish between otherwise identical type names. -
isAbstract
protected boolean isAbstractabstract flag -
restrictions
restrictions -
description
string description -
isIdentifiable
protected boolean isIdentifiableidentifiable flag -
binding
bound java class -
superType
super type -
defaultValue
default value -
isDefaultValueSet
protected boolean isDefaultValueSet -
crs
-
isCrsSet
protected boolean isCrsSet -
minOccurs
Minimum number of occurrences allowed. See minOccurs() function for the default value based on nillable if not explicitly set. -
maxOccurs
Maximum number of occurrences allowed. See maxOccurs() function for the default value (of 1). -
isNillable
protected boolean isNillableTrue if value is allowed to be null.Depending on this value minOccurs, maxOccurs and defaultValue() will return different results.
The default value is
true. -
length
If this value is set an additional restriction will be added based on the length function. -
userData
User data for the attribute. -
ff
filter factory
-
-
Constructor Details
-
AttributeTypeBuilder
public AttributeTypeBuilder()Constructs the builder. -
AttributeTypeBuilder
Constructs the builder specifying the factory used to build attribute types.
-
-
Method Details
-
init
protected void init()Resets all internal state. -
resetTypeState
protected void resetTypeState()Resets all builder state used to build the attribute type.This method is called automatically after
buildType()andbuildGeometryType(). -
resetDescriptorState
protected void resetDescriptorState() -
setFactory
-
init
Initializes builder state from another attribute type. -
init
Initializes builder state from another attribute descriptor. -
setBinding
-
setName
-
setNamespaceURI
-
setCRS
-
isCRSSet
public boolean isCRSSet() -
setDescription
-
setDescription
-
setAbstract
public void setAbstract(boolean isAbstract) -
setIdentifiable
public void setIdentifiable(boolean isIdentifiable) -
setLength
public void setLength(int length) -
addRestriction
-
addUserData
-
setNillable
public void setNillable(boolean isNillable) -
setMaxOccurs
public void setMaxOccurs(int maxOccurs) -
setMinOccurs
public void setMinOccurs(int minOccurs) -
setDefaultValue
-
binding
-
name
-
namespaceURI
-
crs
-
description
-
abstrct
-
identifiable
-
length
-
options
Sets a list of possible valid values for the attribute type being built, and returns a reference to the builder itself -
setOptions
Sets a list of possible valid values for the attribute type being built -
range
Sets a range to which the attribute value should be contained in and returns a reference to the builder itself -
setRange
Sets a range to which the attribute value should be contained in. -
restriction
-
nillable
-
maxOccurs
-
minOccurs
-
defaultValue
-
userData
-
superType
-
buildType
Builds the attribute type.This method resets all state after the attribute is built.
-
buildGeometryType
Builds the geometry attribute type.This method resets all state after the attribute is built.
-
buildDescriptor
Builds an attribute descriptor first building an attribute type from internal state.If
crshas been set viasetCRS(CoordinateReferenceSystem), orbindingis of Geometry. The internal attribute type will be built viabuildGeometryType(), andbuildDescriptor(String, GeometryType)will be called.Otherwise it will be built via
buildType(), andbuildDescriptor(String, AttributeType)will be called.- Parameters:
name- The name of the descriptor.- Throws:
IllegalStateException- If no binding is set- See Also:
-
buildDescriptor
Builds an attribute descriptor specifying its attribute type.Internal state is reset after the descriptor is built.
- Parameters:
name- The name of the descriptor.type- The type referenced by the descriptor.
-
buildDescriptor
Builds a geometry descriptor specifying its attribute type.Internal state is reset after the descriptor is built.
- Parameters:
name- The name of the descriptor.type- The geometry type referenced by the descriptor.
-
buildDescriptor
-
buildDescriptor
-
restrictions
-
lengthRestriction
Helper method to create a "length" filter.
-