Package org.apache.sis.feature.builder

# Class PropertyTypeBuilder

Object
TypeBuilder
PropertyTypeBuilder

All Implemented Interfaces:
  `Localized`

Direct Known Subclasses:
  `AssociationRoleBuilder`, `AttributeTypeBuilder`

public abstract class PropertyTypeBuilder extends TypeBuilder
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 template
- `FeatureTypeBuilder​.addAssociation(DefaultFeatureType)`
- `FeatureTypeBuilder​.addAssociation(GenericName)`
- `FeatureTypeBuilder​.addAssociation(DefaultAssociationRole)` for using an existing association as a template

Since:
  0.8

Defined in the `sis-feature` module

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract AbstractIdentifiedType`
  `build()`
  Builds the property type from the information specified to this builder.
  `final int`
  `getMaximumOccurs()`
  Returns the maximum number of property values.
  `int`
  `getMinimumOccurs()`
  Returns the minimum number of property values.
  `void`
  `remove()`
  Removes this property from the `FeatureTypeBuilder`.
  `PropertyTypeBuilder`
  `setDefinition(CharSequence definition)`
  Sets a concise definition of the element.
  `PropertyTypeBuilder`
  `setDeprecated(boolean deprecated)`
  Sets whether the type is deprecated.
  `PropertyTypeBuilder`
  `setDescription(CharSequence description)`
  Sets optional information beyond that required for concise definition of the element.
  `PropertyTypeBuilder`
  `setDesignation(CharSequence designation)`
  Sets a natural language designator for the element.
  `PropertyTypeBuilder`
  `setMaximumOccurs(int occurs)`
  Sets the maximum number of property values.
  `PropertyTypeBuilder`
  `setMinimumOccurs(int occurs)`
  Sets the minimum number of property values.
  `PropertyTypeBuilder`
  `setName(CharSequence localPart)`
  Sets the `PropertyType` name as a simple string (local name).
  `PropertyTypeBuilder`
  `setName(CharSequence... components)`
  Sets the `PropertyType` name as a string in the given scope.
  `PropertyTypeBuilder`
  `setName(GenericName name)`
  Sets the `PropertyType` name as a generic name.

  ### Methods inherited from class TypeBuilder

  `getDefinition, getDescription, getDesignation, getLocale, getName, isDeprecated, toString`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### setName

    public PropertyTypeBuilder setName(GenericName name)
    Sets the `PropertyType` name as a generic name. See the parent class for more information.
    Overrides:
      `setName` in class `TypeBuilder`
    Parameters:
      `name` - the generic name (can not be `null`).
    Returns:
      `this` for allowing method calls chaining.
    See Also:
      - `TypeBuilder​.getName()`
      - `TypeBuilder​.setName(CharSequence)`
      - `AbstractIdentifiedType​.NAME_KEY`

  - ### setName

    public PropertyTypeBuilder setName(CharSequence localPart)
    Sets the `PropertyType` name as a simple string (local name). See the parent class for more information.
    Overrides:
      `setName` in class `TypeBuilder`
    Parameters:
      `localPart` - the local part of the generic name as a `String` or `InternationalString`.
    Returns:
      `this` for allowing method calls chaining.
    See Also:
      - `TypeBuilder​.getName()`
      - `TypeBuilder​.setName(CharSequence...)`
      - `FeatureTypeBuilder​.getNameSpace()`

  - ### setName

    public PropertyTypeBuilder setName(CharSequence... components)
    Sets the `PropertyType` name as a string in the given scope. See the parent class for more information.
    Overrides:
      `setName` in class `TypeBuilder`
    Parameters:
      `components` - the name components as an array of `String` or `InternationalString` instances.
    Returns:
      `this` for allowing method calls chaining.
    See Also:
      - `TypeBuilder​.getName()`
      - `TypeBuilder​.setName(CharSequence)`
      - `FeatureTypeBuilder​.getNameSpace()`

  - ### 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:
      - `DefaultAttributeType​.getMinimumOccurs()`

  - ### setMinimumOccurs

    public PropertyTypeBuilder setMinimumOccurs(int occurs)
    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:
      - `getMinimumOccurs()`

  - ### getMaximumOccurs

    public final int getMaximumOccurs()
    Returns the maximum number of property values. The returned value is greater than or equal to the `getMinimumOccurs()` value. If there is no maximum, then this method returns `Integer​.MAX_VALUE`.
    Returns:
      the maximum number of property values, or `Integer​.MAX_VALUE` if none.
    See Also:
      - `DefaultAttributeType​.getMaximumOccurs()`

  - ### setMaximumOccurs

    public PropertyTypeBuilder setMaximumOccurs(int occurs)
    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:
      - `getMaximumOccurs()`

  - ### setDefinition

    public PropertyTypeBuilder setDefinition(CharSequence definition)
    Sets a concise definition of the element.
    Overrides:
      `setDefinition` in class `TypeBuilder`
    Parameters:
      `definition` - a concise definition of the element, or `null` if none.
    Returns:
      `this` for allowing method calls chaining.
    See Also:
      - `TypeBuilder​.getDefinition()`
      - `AbstractIdentifiedType​.DEFINITION_KEY`

  - ### setDesignation

    public PropertyTypeBuilder setDesignation(CharSequence designation)
    Sets a natural language designator for the element. This can be used as an alternative to the name in user interfaces.
    Overrides:
      `setDesignation` in class `TypeBuilder`
    Parameters:
      `designation` - a natural language designator for the element, or `null` if none.
    Returns:
      `this` for allowing method calls chaining.
    See Also:
      - `TypeBuilder​.getDesignation()`
      - `AbstractIdentifiedType​.DESIGNATION_KEY`

  - ### setDescription

    public PropertyTypeBuilder setDescription(CharSequence description)
    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 class `TypeBuilder`
    Parameters:
      `description` - information beyond that required for concise definition of the element, or `null` if none.
    Returns:
      `this` for allowing method calls chaining.
    See Also:
      - `TypeBuilder​.getDescription()`
      - `AbstractIdentifiedType​.DESCRIPTION_KEY`

  - ### setDeprecated

    public PropertyTypeBuilder setDeprecated(boolean deprecated)
    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 class `TypeBuilder`
    Parameters:
      `deprecated` - whether this type is deprecated.
    Returns:
      `this` for allowing method calls chaining.
    See Also:
      - `TypeBuilder​.isDeprecated()`
      - `AbstractIdentifiedType​.DEPRECATED_KEY`

  - ### build

    public abstract AbstractIdentifiedType build() throws IllegalStateException
    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 created `PropertyType` instance is returned (see `AttributeTypeBuilder​.build()` for more information).
    Warning: In a future SIS version, the return type may be changed to `org​.opengis​.feature​.PropertyType`. This change is pending GeoAPI revision.
    Specified by:
      `build` in class `TypeBuilder`
    Returns:
      the property type.
    Throws:
      `IllegalStateException` - if the builder contains inconsistent information.

  - ### remove

    public void remove()
    Removes this property from the `FeatureTypeBuilder`. After this method has been invoked, this `PropertyTypeBuilder` instance is no longer in the list returned by `FeatureTypeBuilder​.properties()` and attempts to invoke any setter method on `this` will cause an `IllegalStateException` to be thrown.