Package org.apache.sis.feature.builder
Class PropertyTypeBuilder
java.lang.Object
org.apache.sis.feature.builder.TypeBuilder
org.apache.sis.feature.builder.PropertyTypeBuilder
- All Implemented Interfaces:
Localized
- Direct Known Subclasses:
AssociationRoleBuilder
,AttributeTypeBuilder
,OperationWrapper
Describes one property of the
FeatureType
to be built by an FeatureTypeBuilder
.
A different instance of PropertyTypeBuilder
exists for each property to describe.
Those instances can be created by:
FeatureTypeBuilder.addAttribute(Class)
FeatureTypeBuilder.addAttribute(DefaultAttributeType)
for using an existing attribute as a templateFeatureTypeBuilder.addAssociation(DefaultFeatureType)
FeatureTypeBuilder.addAssociation(GenericName)
FeatureTypeBuilder.addAssociation(DefaultAssociationRole)
for using an existing association as a template
- Since:
- 0.8
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
The maximum number of property values.(package private) int
The minimum number of property values.private FeatureTypeBuilder
The feature type builder instance that created thisPropertyTypeBuilder
. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newPropertyType
builder.PropertyTypeBuilder
(PropertyTypeBuilder builder) Creates a new builder initialized to the values of the given builder. -
Method Summary
Modifier and TypeMethodDescriptionabstract AbstractIdentifiedType
build()
Builds the property type from the information specified to this builder.(package private) void
If thePropertyType
created by the last call tobuild()
has been cached, clears that cache.(package private) final org.opengis.util.GenericName
createGenericName
(CharSequence... names) Creates a generic name in the feature namespace.(package private) final org.opengis.util.GenericName
createLocalName
(CharSequence name) Creates a local name in the feature namespace.(package private) final void
dispose()
Flags this builder as a disposed one.final int
Returns the maximum number of property values.int
Returns the minimum number of property values.(package private) boolean
Returnstrue
ifAttributeRole.IDENTIFIER_COMPONENT
has been associated to this property.(package private) final FeatureTypeBuilder
owner()
Returns the feature type builder instance that created thisPropertyTypeBuilder
.void
remove()
Removes this property from theFeatureTypeBuilder
.setDefinition
(CharSequence definition) Sets a concise definition of the element.setDeprecated
(boolean deprecated) Sets whether the type is deprecated.setDescription
(CharSequence description) Sets optional information beyond that required for concise definition of the element.setDesignation
(CharSequence designation) Sets a natural language designator for the element.setMaximumOccurs
(int occurs) Sets the maximum number of property values.setMinimumOccurs
(int occurs) Sets the minimum number of property values.setName
(CharSequence localPart) Sets thePropertyType
name as a simple string (local name).setName
(CharSequence... components) Sets thePropertyType
name as a string in the given scope.setName
(org.opengis.util.GenericName name) Sets thePropertyType
name as a generic name.Methods inherited from class org.apache.sis.feature.builder.TypeBuilder
appendStringTo, ensureAlive, ensureNonEmpty, ensureNonNull, errors, forName, getDefaultName, getDefinition, getDescription, getDesignation, getDisplayName, getLocale, getName, identification, initialize, isDeprecated, reset, resources, toString, toStringInternal
-
Field Details
-
owner
The feature type builder instance that created thisPropertyTypeBuilder
. This is set at construction time and considered as immutable until it is set tonull
.- See Also:
-
minimumOccurs
int minimumOccursThe minimum number of property values. The default value is 1, unless otherwise specified bysetMinimumOccurs(int)
.- See Also:
-
maximumOccurs
int maximumOccursThe maximum number of property values. The default value is 1, unless otherwise specified bysetMaximumOccurs(int)
.- See Also:
-
-
Constructor Details
-
PropertyTypeBuilder
PropertyTypeBuilder(PropertyTypeBuilder builder) Creates a new builder initialized to the values of the given builder. This constructor is forAttributeTypeBuilder.setValueClass(Class)
implementation.- Parameters:
builder
- the builder from which to copy values.
-
PropertyTypeBuilder
PropertyTypeBuilder(FeatureTypeBuilder owner) Creates a newPropertyType
builder.- Parameters:
owner
- the builder of theFeatureType
for which to add this property.
-
-
Method Details
-
owner
Returns the feature type builder instance that created thisPropertyTypeBuilder
. -
setName
Sets thePropertyType
name as a generic name. See the parent class for more information.- Overrides:
setName
in classTypeBuilder
- Parameters:
name
- the generic name (cannot benull
).- Returns:
this
for allowing method calls chaining.- See Also:
-
setName
Sets thePropertyType
name as a simple string (local name). See the parent class for more information.- Overrides:
setName
in classTypeBuilder
- Parameters:
localPart
- the local part of the generic name as aString
orInternationalString
.- Returns:
this
for allowing method calls chaining.- See Also:
-
setName
Sets thePropertyType
name as a string in the given scope. See the parent class for more information.- Overrides:
setName
in classTypeBuilder
- Parameters:
components
- the name components as an array ofString
orInternationalString
instances.- Returns:
this
for allowing method calls chaining.- See Also:
-
getMinimumOccurs
public int getMinimumOccurs()Returns the minimum number of property values. The returned value is greater than or equal to zero.- Returns:
- the minimum number of property values.
- See Also:
-
setMinimumOccurs
Sets the minimum number of property values. If the given number is greater than the maximal number of property values, than the maximum is also set to that value.- Parameters:
occurs
- the new minimum number of property values.- Returns:
this
for allowing method calls chaining.- See Also:
-
getMaximumOccurs
public final int getMaximumOccurs()Returns the maximum number of property values. The returned value is greater than or equal to thegetMinimumOccurs()
value. If there is no maximum, then this method returnsInteger.MAX_VALUE
.- Returns:
- the maximum number of property values, or
Integer.MAX_VALUE
if none. - See Also:
-
setMaximumOccurs
Sets the maximum number of property values. If the given number is less than the minimal number of property values, than the minimum is also set to that value.Integer.MAX_VALUE
means that there is no maximum.- Parameters:
occurs
- the new maximum number of property values.- Returns:
this
for allowing method calls chaining.- See Also:
-
setDefinition
Sets a concise definition of the element.- Overrides:
setDefinition
in classTypeBuilder
- Parameters:
definition
- a concise definition of the element, ornull
if none.- Returns:
this
for allowing method calls chaining.- See Also:
-
setDesignation
Sets a natural language designator for the element. This can be used as an alternative to the name in user interfaces.- Overrides:
setDesignation
in classTypeBuilder
- Parameters:
designation
- a natural language designator for the element, ornull
if none.- Returns:
this
for allowing method calls chaining.- See Also:
-
setDescription
Sets optional information beyond that required for concise definition of the element. The description may assist in understanding the feature scope and application. If the type is deprecated, then the description should give indication about the replacement (e.g. "superceded by …").- Overrides:
setDescription
in classTypeBuilder
- Parameters:
description
- information beyond that required for concise definition of the element, ornull
if none.- Returns:
this
for allowing method calls chaining.- See Also:
-
setDeprecated
Sets whether the type is deprecated. If the type is deprecated, then the description should be set to an indication about the replacement (e.g. "superceded by …").- Overrides:
setDeprecated
in classTypeBuilder
- Parameters:
deprecated
- whether this type is deprecated.- Returns:
this
for allowing method calls chaining.- See Also:
-
isIdentifier
boolean isIdentifier()Returnstrue
ifAttributeRole.IDENTIFIER_COMPONENT
has been associated to this property. -
createLocalName
Creates a local name in the feature namespace.- Specified by:
createLocalName
in classTypeBuilder
-
createGenericName
Creates a generic name in the feature namespace.- Specified by:
createGenericName
in classTypeBuilder
-
clearCache
void clearCache()If thePropertyType
created by the last call tobuild()
has been cached, clears that cache. This method must be invoked every time that a setter method is invoked.- Specified by:
clearCache
in classTypeBuilder
- See Also:
-
build
Builds the property type from the information specified to this builder. If a type has already been built and this builder state has not changed since the type creation, then the previously createdPropertyType
instance is returned (seeAttributeTypeBuilder.build()
for more information).Warning: In a future SIS version, the return type may be changed toorg.opengis.feature.PropertyType
. This change is pending GeoAPI revision.- Specified by:
build
in classTypeBuilder
- Returns:
- the property type.
- Throws:
IllegalStateException
- if the builder contains inconsistent information.
-
dispose
final void dispose()Flags this builder as a disposed one. The builder should not be used anymore after this method call. -
remove
public void remove()Removes this property from theFeatureTypeBuilder
. After this method has been invoked, thisPropertyTypeBuilder
instance is no longer in the list returned byFeatureTypeBuilder.properties()
and attempts to invoke any setter method onthis
will cause anIllegalStateException
to be thrown.- Overrides:
remove
in classTypeBuilder
-