Class AttributeTypeBuilder


  • public class AttributeTypeBuilder
    extends Object
    Builder for attribute types and descriptors.

    Building an attribute type:

     
      //create the builder
      AttributeTypeBuilder builder = new AttributeTypeBuilder();
    
      //set type information
      builder.setName( "intType" ):
      builder.setBinding( Integer.class );
      builder.setNillable( false );
    
      //build the type
      AttributeType type = builder.buildType();
     
     

    Building an attribute descriptor:

     
      //create the builder
      AttributeTypeBuilder builder = new AttributeTypeBuilder();
    
      //set type information
      builder.setName( "intType" ):
      builder.setBinding( Integer.class );
      builder.setNillable( false );
    
      //set descriptor information
      builder.setMinOccurs(0);
      builder.setMaxOccurs(1);
      builder.setNillable(true);
    
      //build the descriptor
      AttributeDescriptor descriptor = builder.buildDescriptor("intProperty");
     
     

    This class maintains state and is not thread safe.

    Author:
    Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
    • Field Detail

      • name

        protected String name
        Local name used to name a descriptor; or combined with namespaceURI to name a type.
      • namespaceURI

        protected String namespaceURI
        namespace used to distingish between otherwise identical type names.
      • isAbstract

        protected boolean isAbstract
        abstract flag
      • restrictions

        protected List<Filter> restrictions
        restrictions
      • isIdentifiable

        protected boolean isIdentifiable
        identifiable flag
      • binding

        protected Class<?> binding
        bound java class
      • defaultValue

        protected Object defaultValue
        default value
      • isDefaultValueSet

        protected boolean isDefaultValueSet
      • isCrsSet

        protected boolean isCrsSet
      • minOccurs

        protected Integer minOccurs
        Minimum number of occurrences allowed. See minOccurs() function for the default value based on nillable if not explicitly set.
      • maxOccurs

        protected Integer maxOccurs
        Maximum number of occurrences allowed. See maxOccurs() function for the default value (of 1).
      • isNillable

        protected boolean isNillable
        True if value is allowed to be null.

        Depending on this value minOccurs, maxOccurs and defaultValue() will return different results.

        The default value is true.

      • length

        protected Integer length
        If this value is set an additional restriction will be added based on the length function.
      • userData

        protected Map<Object,​Object> userData
        User data for the attribute.
    • Constructor Detail

      • AttributeTypeBuilder

        public AttributeTypeBuilder()
        Constructs the builder.
      • AttributeTypeBuilder

        public AttributeTypeBuilder​(FeatureTypeFactory factory)
        Constructs the builder specifying the factory used to build attribute types.