# Package org.apache.sis.feature.builder

Helper classes for creating `FeatureType` instances.

See: Description

- Class Summary
  Class | Description
  --- | ---
  AssociationRoleBuilder | Describes one association from the `FeatureType` to be built by an `FeatureTypeBuilder` to another `FeatureType`.
  AttributeTypeBuilder<V> | Describes one `AttributeType` which will be part of the feature type to be built by a `FeatureTypeBuilder`.
  CharacteristicTypeBuilder<V> | Describes one characteristic of the `AttributeType` will will be built by a `FeatureTypeBuilder`.
  FeatureTypeBuilder | Helper class for the creation of `FeatureType` instances.
  PropertyTypeBuilder | Describes one property of the `FeatureType` to be built by an `FeatureTypeBuilder`.
  TypeBuilder | Information common to all kind of types (feature, association, characteristics).

- Enum Summary
  Enum | Description
  --- | ---
  AttributeRole | Roles that can be associated to some attributes for instructing `FeatureTypeBuilder` how to generate pre-defined operations.

## Package org.apache.sis.feature.builder Description

Helper classes for creating `FeatureType` instances. Usage of this package is not mandatory, but make easier to create `DefaultFeatureType` instances together with their attributes and associations.

The starting point is `FeatureTypeBuilder`. The following example creates a feature type for a capital, as a special kind of city, named "Utopia" by default:

    FeatureTypeBuilder builder;

    // Create a feature type for a city, which contains a name and a population.
    builder = new FeatureTypeBuilder() .setName("City");
    builder.addAttribute(String.class) .setName("name").setDefaultValue("Utopia");
    builder.addAttribute(Integer.class).setName("population");
    FeatureType city = builder.build();

    // Create a subclass for a city which is also a capital.
    builder = new FeatureTypeBuilder().setName("Capital").setSuperTypes(city);
    builder.addAttribute(String.class).setName("parliament");
    FeatureType capital = builder.build();

A call to `System​.out​.println(capital)` prints the following table:

    Capital ⇾ City
    ┌────────────┬─────────┬─────────────┬───────────────┐
    │ Name       │ Type    │ Cardinality │ Default value │
    ├────────────┼─────────┼─────────────┼───────────────┤
    │ name       │ String  │     [1 … 1] │ Utopia        │
    │ population │ Integer │     [1 … 1] │               │
    │ parliament │ String  │     [1 … 1] │               │
    └────────────┴─────────┴─────────────┴───────────────┘

Since:
  0.8
See Also:
  `DefaultFeatureType`

Defined in the `sis-feature` module

Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.