public abstract class TypeBuilder extends Object implements Localized
LocalName
,
ScopedName
, String
or InternationalString
instance.
All other properties are optional.
AttributeType
s and AssociationRole
s to create
within a FeatureType
share the same namespace.
For making name creations more convenient, the namespace can be
specified once and applied automatically
to all names created by the setName(CharSequence)
method.
Note that namespaces will not be visible in the name string representation unless the fully
qualified name is requested.
Example:
FeatureTypeBuilder builder = new FeatureTypeBuilder().setNameSpace("MyNameSpace").setName("City"); FeatureType city = builder.build(); System.out.println(city.getName()); // Prints "City" System.out.println(city.getName().toFullyQualifiedName()); // Prints "MyNameSpace:City"
Defined in the sis-feature
module
Modifier and Type | Method and Description |
---|---|
abstract AbstractIdentifiedType |
build()
Builds the feature or property type from the information specified to this builder.
|
CharSequence |
getDefinition()
Returns a concise definition of the element.
|
CharSequence |
getDescription()
Returns optional information beyond that required for concise definition of the element.
|
CharSequence |
getDesignation()
Returns a natural language designator for the element.
|
Locale |
getLocale()
Returns the locale used for formatting error messages, or
null if unspecified. |
GenericName |
getName()
Returns the name of the
IdentifiedType to create, or null if undefined. |
boolean |
isDeprecated()
Returns
true if the type is deprecated. |
TypeBuilder |
setDefinition(CharSequence definition)
Sets a concise definition of the element.
|
TypeBuilder |
setDeprecated(boolean deprecated)
Sets whether the type is deprecated.
|
TypeBuilder |
setDescription(CharSequence description)
Sets optional information beyond that required for concise definition of the element.
|
TypeBuilder |
setDesignation(CharSequence designation)
Sets a natural language designator for the element.
|
TypeBuilder |
setName(CharSequence... components)
Sets the
IdentifiedType name as a string in the given scope. |
TypeBuilder |
setName(CharSequence localPart)
Sets the
IdentifiedType name as a simple string (local name). |
TypeBuilder |
setName(GenericName name)
Sets the
IdentifiedType name as a generic name. |
String |
toString()
Returns a string representation of this object.
|
public GenericName getName()
IdentifiedType
to create, or null
if undefined.
This method returns the value built from the last call to a setName(…)
method,
or a default name or null
if no name has been explicitely specified.IdentifiedType
to create (may be a default name or null
).setName(GenericName)
,
AbstractIdentifiedType.getName()
,
FeatureTypeBuilder.getNameSpace()
public TypeBuilder setName(GenericName name)
IdentifiedType
name as a generic name.
If another name was defined before this method call, that previous value will be discarded.
setName(…)
convenience methods in this builder delegate to this method.
Consequently this method can be used as a central place where to control the creation of all names.name
- the generic name (can not be null
).this
for allowing method calls chaining.getName()
,
setName(CharSequence)
,
AbstractIdentifiedType.NAME_KEY
public TypeBuilder setName(CharSequence localPart)
IdentifiedType
name as a simple string (local name).
The namespace will be the value specified by the last call to FeatureTypeBuilder.setNameSpace(CharSequence)
,
but that namespace will not be visible in the string representation unless the fully qualified name is requested.
This convenience method creates a LocalName
instance from
the given CharSequence
, then delegates to setName(GenericName)
.
localPart
- the local part of the generic name as a String
or InternationalString
.this
for allowing method calls chaining.getName()
,
setName(CharSequence...)
,
FeatureTypeBuilder.getNameSpace()
public TypeBuilder setName(CharSequence... components)
IdentifiedType
name as a string in the given scope.
The components
array must contain at least one element.
The last component (the tip) will be sufficient
in many cases for calls to the AbstractFeature.getProperty(String)
method.
The other elements before the last one are optional and can be used for resolving ambiguity.
They will be visible as the name path.
setName("A", "B", "C")
will create a "A:B:C" name.
A property built with this name can be obtained from a feature by a call to feature.getProperty("C")
if there is no ambiguity, or otherwise by a call to feature.getProperty("B:C")
(if non-ambiguous) or
feature.getProperty("A:B:C")
.components
array, the name may also contain
a namespace specified by the last call to FeatureTypeBuilder.setNameSpace(CharSequence)
.
But contrarily to the specified components, the namespace will not be visible in the name
string representation unless the
fully qualified name is requested.
This convenience method creates a LocalName
or ScopedName
instance depending on whether the names
array contains exactly 1 element or more than 1 element, then
delegates to setName(GenericName)
.
components
- the name components as an array of String
or InternationalString
instances.this
for allowing method calls chaining.getName()
,
setName(CharSequence)
,
FeatureTypeBuilder.getNameSpace()
public CharSequence getDefinition()
null
if none.AbstractIdentifiedType.getDefinition()
public TypeBuilder setDefinition(CharSequence definition)
definition
- a concise definition of the element, or null
if none.this
for allowing method calls chaining.getDefinition()
,
AbstractIdentifiedType.DEFINITION_KEY
public CharSequence getDesignation()
null
if none.AbstractIdentifiedType.getDesignation()
public TypeBuilder setDesignation(CharSequence designation)
designation
- a natural language designator for the element, or null
if none.this
for allowing method calls chaining.getDesignation()
,
AbstractIdentifiedType.DESIGNATION_KEY
public CharSequence getDescription()
null
if none.AbstractIdentifiedType.getDescription()
public TypeBuilder setDescription(CharSequence description)
description
- information beyond that required for concise definition of the element, or null
if none.this
for allowing method calls chaining.getDescription()
,
AbstractIdentifiedType.DESCRIPTION_KEY
public boolean isDeprecated()
true
if the type is deprecated.
If this method returns true
, then the description should give
indication about the replacement (e.g. "superceded by …").AbstractIdentifiedType.isDeprecated()
public TypeBuilder setDeprecated(boolean deprecated)
deprecated
- whether this type is deprecated.this
for allowing method calls chaining.isDeprecated()
,
AbstractIdentifiedType.DEPRECATED_KEY
public Locale getLocale()
null
if unspecified.
If unspecified, the system default locale will be used.getLocale
in interface Localized
null
if unspecified.@Debug public String toString()
public abstract AbstractIdentifiedType build() throws IllegalStateException
IdentifiedType
instance is returned.
org.opengis.feature.IdentifiedType
interface. This change is pending GeoAPI revision.IllegalStateException
- if the builder contains inconsistent information.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.