Class TLcdDataTypeBuilder

java.lang.Object
com.luciad.datamodel.TLcdDataTypeBuilder

public class TLcdDataTypeBuilder extends Object

Builder that allows the creation of a TLcdDataType. The type is created when the data model of this type is created.

Instances of this class can be created via the TLcdDataModelBuilder in which the type is to be defined.

References to other types (for instance to indicate the super type or the type of a property) can be done using a TLcdDataType instance, a string denoting the name of a type in the data model that is being built, or another type builder.

Since:
10.0
See Also:
  • Method Details

    • superType

      public TLcdDataTypeBuilder superType(TLcdDataType aSuperType)
      Sets the super type of this type to the given type.
      Parameters:
      aSuperType - the type to use as super type
      Returns:
      this
    • superType

      public TLcdDataTypeBuilder superType(String aName)
      Sets the super type of this type to the given type. The default super type for a data object type is TLcdCoreDataTypes.DATA_OBJECT_TYPE, for a primitive type is TLcdCoreDataTypes.OBJECT_TYPE.
      Parameters:
      aName - the name of a type in this builder's data model to use as super type
      Returns:
      this
    • superType

      public TLcdDataTypeBuilder superType(TLcdDataTypeBuilder aTypeBuilder)
      Sets the super type of this type to the given type. The default super type for a data object type is TLcdCoreDataTypes.DATA_OBJECT_TYPE, for a primitive type is TLcdCoreDataTypes.OBJECT_TYPE.
      Parameters:
      aTypeBuilder - a type builder of which the type is to be used as super type
      Returns:
      this
    • primitive

      public TLcdDataTypeBuilder primitive(boolean aIsPrimitive)
      Defines whether or not the type that is being built will be a primitive type. The default value for this property is false.
      Parameters:
      aIsPrimitive - boolean that specifies if the type to be built will be primitive or not
      Returns:
      this
    • instanceClass

      public TLcdDataTypeBuilder instanceClass(Class<?> aInstanceClass)
      Sets the instance class for this type. The default instance class for data object types is ILcdDataObject, for primitive types java.lang.Object.
      Parameters:
      aInstanceClass - the Java class that is to be used as instance class for the type that is being built
      Returns:
      this
    • getName

      public String getName()
      Returns the name of the type that is being built.
      Returns:
      the name of the type that is being built
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • abstractType

      public TLcdDataTypeBuilder abstractType(boolean aIsAbstract)
      Determines if the type to be built will be abstract or not. By default a type is not abstract.
      Parameters:
      aIsAbstract - boolean that specifies if the data type is to abstract
      Returns:
      this
    • possibleValues

      public TLcdDataTypeBuilder possibleValues(Object... aObjects)
      Marks the type as an enumeration and provides it with all possible values. This happens automatically in case the instance class is a java.lang.Enum. The type will automatically be made primitive.
      Parameters:
      aObjects - list of all values this enumeration can take. null should never be considered as a possible value; if a property may be null, this should be indicated through the TLcdDataProperty.isNullable() flag.
      Returns:
      this
    • possibleValues

      public TLcdDataTypeBuilder possibleValues(Set<?> aValues)
      Marks the type as an enumeration and provides it with all possible values. This happens automatically in case the instance class is a java.lang.Enum. The type will automatically be made primitive.
      Parameters:
      aValues - set of all values this enumeration can take. null should never be considered as a possible value; if a property may be null, this should be indicated through the TLcdDataProperty.isNullable() flag.
      Returns:
      this
    • addProperty

      public TLcdDataPropertyBuilder addProperty(String aName, TLcdDataType aType)

      Adds a property with the given name and type to the type that is being built. The returned property builder is single valued, contained and nullable.

      The name of the property can only contain letters, digits, periods ('.'), dashes ('-'), and underscores ('_').

      Parameters:
      aName - the name of the property that is to be added
      aType - the type for the property that is to be added
      Returns:
      a property builder that can be used to further modify the property that is to be added
    • addProperty

      public TLcdDataPropertyBuilder addProperty(String aName, String aType)

      Adds a property with the given name and type to the type that is being built. The returned property builder is single valued, contained and nullable.

      The name of the property can only contain letters, digits, periods ('.'), dashes ('-'), and underscores ('_').

      Parameters:
      aName - the name of the property that is to be added
      aType - the name of a type in this builder's data model for the property that is to be added
      Returns:
      a property builder that can be used to further modify the property that is to be added
    • getDataPropertyBuilders

      public List<TLcdDataPropertyBuilder> getDataPropertyBuilders()
      Returns a list containing all the property builders of this data type builder.
      Returns:
      a list containing all property builders of this data type
      Throws:
      UnsupportedOperationException - when the returned list is modified
    • getDataPropertyBuilder

      public TLcdDataPropertyBuilder getDataPropertyBuilder(String aPropertyName)
      Returns the property builder for the given property name. If a property for the given name does not exist this method will return null.
      Parameters:
      aPropertyName - the property name
      Returns:
      a property builder or null
    • addProperty

      public TLcdDataPropertyBuilder addProperty(String aName, TLcdDataTypeBuilder aTypeBuilder)

      Adds a property with the given name and type to the type that is being built. The returned property builder is single valued, contained and nullable.

      The name of the property can only contain letters, digits, periods ('.'), dashes ('-'), and underscores ('_').

      Parameters:
      aName - the name of the property that is to be added
      aTypeBuilder - a type builder for the type of the property that is to be added
      Returns:
      a property builder that can be used to further modify the property that is to be added
    • getDataModelBuilder

      public TLcdDataModelBuilder getDataModelBuilder()
      Returns the data model builder for the data model that contains the type that is being built by this type builder.
      Returns:
      the associated data model builder
    • dataObjectFactory

      public TLcdDataTypeBuilder dataObjectFactory(ILcdDataObjectFactory aFactory)
      Sets the object factory to use for this type.
      Parameters:
      aFactory - the object factory to use for this type
      Returns:
      this
    • annotate

      public TLcdDataTypeBuilder annotate(ILcdAnnotation aAnnotation)
      Adds an annotation to the type that is being built. The annotation can be retrieved on the type using TLcdDataType.getAnnotation(Class).
      Parameters:
      aAnnotation - the annotation to add
      Returns:
      this
    • annotateFromFactory

      public TLcdDataTypeBuilder annotateFromFactory(TLcdDataTypeBuilder.TypeAnnotationFactory<?> aAnnotationFactory)

      Annotates the type that is being built. The actual annotation is the return value of TLcdDataTypeBuilder.TypeAnnotationFactory.createAnnotation(TLcdDataType). Once the type is created, the annotation can be retrieved using TLcdDataType.getAnnotation(Class).

      The use of the factory makes it possible to refer to the type from inside the annotation. The actual annotation value will be created at the end of the initialization of the type.

      Parameters:
      aAnnotationFactory - a factory that is able to create the value of the annotation
      Returns:
      this