Class AttributeBuilder
- Direct Known Subclasses:
AppSchemaAttributeBuilder
- Author:
- Justin Deoliveira (The Open Planning Project)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an attribute to the complex attribute being built.Adds an attribute to the complex attribute being built.Adds an attribute to the complex attribute being built.Adds an attribute to the complex attribute being built.Adds an attribute to the complex attribute being built.Adds an attribute to the complex attribute being built.addAnyTypeValue
(Object value, AttributeType type, AttributeDescriptor descriptor, String id) Special case for any type.addComplexAnyTypeAttribute
(Object value, AttributeDescriptor descriptor, String id) Create a complex attribute for XS.AnyType, since it's defined as a simple type.void
Adds an association to the complex attribute being built.void
Adds an association to the complex attribute being built.void
Adds an association to the complex attribute being built.protected AssociationDescriptor
associationDescriptor
(Name name) protected AttributeDescriptor
attributeDescriptor
(Name name) build()
Builds the attribute.Builds the attribute.buildSimple
(String id, Object value) protected Attribute
create
(Object value, AttributeType type, AttributeDescriptor descriptor, String id) Factors out attribute creation code, needs to be called with either one of type or descriptor null.createComplexAttribute
(Object value, ComplexType type, AttributeDescriptor descriptor, String id) Create complex attributegetCRS()
Returns the underlying attribute factory.This namespace will be used when constructing attribute names.Convenience accessor for properties list which does the null check.getType()
void
init()
Initializes the builder to its initial state, the same state it is in directly after being instantiated.void
Initializes the state of the builder based on a previously built attribute.Convenience accessor for properties list which does the null check.void
Sets the coordinate reference system of the built feature.void
setDefaultGeometry
(Object defaultGeometry) Sets the default geometry of the feature.void
setDescriptor
(AttributeDescriptor descriptor) Sets the descriptor of the attribute being built.void
setFeatureFactory
(FeatureFactory attributeFactory) Sets the underlying attribute factory.void
setNamespaceURI
(String namespace) This namespace will be used when constructing attribute names.void
setType
(AttributeType type) Sets the type of the attribute being built.
-
Field Details
-
ANYTYPE_TYPE
-
-
Constructor Details
-
AttributeBuilder
-
-
Method Details
-
getFeatureFactory
Returns the underlying attribute factory. -
setFeatureFactory
Sets the underlying attribute factory. -
init
public void init()Initializes the builder to its initial state, the same state it is in directly after being instantiated. -
init
Initializes the state of the builder based on a previously built attribute.This method is useful when copying another attribute.
-
setNamespaceURI
This namespace will be used when constructing attribute names. -
getNamespaceURI
This namespace will be used when constructing attribute names.- Returns:
- namespace will be used when constructing attribute names.
-
setType
Sets the type of the attribute being built.When building a complex attribute, this type is used a reference to obtain the types of contained attributes.
-
setDescriptor
Sets the descriptor of the attribute being built.When building a complex attribute, this type is used a reference to obtain the types of contained attributes.
-
getType
- Returns:
- The type of the attribute being built.
-
setCRS
Sets the coordinate reference system of the built feature. -
getCRS
- Returns:
- The coordinate reference system of the feature, or null if not set.
-
setDefaultGeometry
Sets the default geometry of the feature. -
getDefaultGeometry
- Returns:
- The default geometry of the feature.
-
add
Adds an attribute to the complex attribute being built.
This method uses the result of
getNamespaceURI()
to build a qualified attribute name.This method uses the type supplied in
setType(AttributeType)
in order to determine the attribute type.- Parameters:
name
- The name of the attribute.value
- The value of the attribute.
-
associate
Adds an association to the complex attribute being built.
This method uses the result of
getNamespaceURI()
to build a qualified attribute name.This method uses the type supplied in
setType(AttributeType)
in order to determine the association type.- Parameters:
value
- The value of the association, an attribute.name
- The name of the association.
-
add
Adds an attribute to the complex attribute being built.
This method uses the type supplied in
setType(AttributeType)
in order to determine the attribute type.- Parameters:
value
- The value of the attribute.name
- The name of the attribute.namespaceURI
- The namespace of the attribute.
-
associate
Adds an association to the complex attribute being built.
This method uses the type supplied in
setType(AttributeType)
in order to determine the association type.- Parameters:
attribute
- The value of the association, an attribute.name
- The name of the association.namespaceURI
- The namespace of the association
-
add
Adds an attribute to the complex attribute being built.
This method uses the type supplied in
setType(AttributeType)
in order to determine the attribute type.- Parameters:
name
- The name of the attribute.value
- The value of the attribute.
-
associate
Adds an association to the complex attribute being built.
This method uses the type supplied in
setType(AttributeType)
in order to determine the association type.- Parameters:
value
- The value of the association, an attribute.name
- The name of the association.
-
add
Adds an attribute to the complex attribute being built.
The result of
getNamespaceURI()
to build a qualified attribute name.This method uses the type supplied in
setType(AttributeType)
in order to determine the attribute type.- Parameters:
id
- The id of the attribute.name
- The name of the attribute.value
- The value of the attribute.
-
add
Adds an attribute to the complex attribute being built.
This method uses the type supplied in
setType(AttributeType)
in order to determine the attribute type.- Parameters:
id
- The id of the attribute.value
- The value of the attribute.name
- The name of the attribute.namespaceURI
- The namespace of the attribute.
-
add
Adds an attribute to the complex attribute being built.
This method uses the type supplied in
setType(AttributeType)
in order to determine the attribute type.- Parameters:
id
- The id of the attribute.name
- The name of the attribute.value
- The value of the attribute.
-
properties
Convenience accessor for properties list which does the null check. -
associationDescriptor
-
attributeDescriptor
-
create
protected Attribute create(Object value, AttributeType type, AttributeDescriptor descriptor, String id) Factors out attribute creation code, needs to be called with either one of type or descriptor null. -
createComplexAttribute
public ComplexAttribute createComplexAttribute(Object value, ComplexType type, AttributeDescriptor descriptor, String id) Create complex attribute -
build
Builds the attribute.The class of the attribute built is determined from its type set with
setType(AttributeType)
.- Returns:
- The build attribute.
-
build
Builds the attribute.The class of the attribute built is determined from its type set with
setType(AttributeType)
.- Parameters:
id
- The id of the attribute, or null.- Returns:
- The build attribute.
-
addAnyTypeValue
public Attribute addAnyTypeValue(Object value, AttributeType type, AttributeDescriptor descriptor, String id) Special case for any type. Skip validating existence in the schema, since anyType legally can be casted into anything.- Parameters:
value
- the value to be settype
- the type of the valuedescriptor
- the attribute descriptor of anyType type
-
addComplexAnyTypeAttribute
public Attribute addComplexAnyTypeAttribute(Object value, AttributeDescriptor descriptor, String id) Create a complex attribute for XS.AnyType, since it's defined as a simple type. We need a complex attribute so we can set xlink:href in it. -
getDescriptor
- Returns:
- The descriptor of the attribute being built or null there is no descriptor (this occurs if setType() was used).
-
getCRS
- Returns:
- The coordinate reference system of the feature, or null if not set.
-
getProperties
Convenience accessor for properties list which does the null check. -
buildSimple
-