Package com.luciad.datamodel
Class TLcdDataPropertyBuilder
java.lang.Object
com.luciad.datamodel.TLcdDataPropertyBuilder
Builder that allows the creation of
TLcdDataProperty
instances
for a certain data model.
Instances of this class can be created via the TLcdDataTypeBuilder
in which the
property is to be defined.
- Since:
- 10.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
This factory interface offers a convenient way to annotate a property while it is being built. -
Method Summary
Modifier and TypeMethodDescriptionannotate
(ILcdAnnotation aAnnotation) Adds an annotation to the property that is being built.annotateFromFactory
(TLcdDataPropertyBuilder.PropertyAnnotationFactory<?> aAnnotationFactory) Annotates the data property that is being built.collectionType
(TLcdDataProperty.CollectionType aCollectionType) Sets the collection type for the property that is to be built.contained
(boolean aValue) Controls if the property that is to be created should be contained in its owning instance.defaultValue
(Object aValue) Sets the default value for this property to the given value.Returns the type builder of the type that declares the property that this builder builds.getName()
Returns the name of the property that is being built.map
(TLcdDataType aKeyType) Marks the property to be built as aTLcdDataProperty.CollectionType.MAP
with the type as key type.map
(TLcdDataTypeBuilder aTypeBuilder) Marks the property to be built as aTLcdDataProperty.CollectionType.MAP
with the type of the given type builder as key type.Marks the property to be built as aTLcdDataProperty.CollectionType.MAP
with the type with the given name as key type.nullable
(boolean aValue) Controls if the property that is to be created should be nullable.sourceName
(String aSourceName) Set the original name of this property, as defined in the source data.
-
Method Details
-
defaultValue
Sets the default value for this property to the given value.- Parameters:
aValue
- the value that is to be used as default- Returns:
- this
-
nullable
Controls if the property that is to be created should be nullable. A property that is nullable is not mandatory. By default a property is nullable.- Parameters:
aValue
- boolean that specifies if the property is to be nullable- Returns:
- this
-
sourceName
Set the original name of this property, as defined in the source data. This may differ from theactual name
of this property within theTLcdDataType
, because that name can contain only alphanumeric characters and underscores and may need to be sanitized. Calling this method is optional. By default, the source name is the same asgetName()
.- Returns:
- this property builder
- Since:
- 2024.0
-
getName
Returns the name of the property that is being built.- Returns:
- the name of the property that is being built
-
getDeclaringTypeBuilder
Returns the type builder of the type that declares the property that this builder builds.- Returns:
- the type builder of the type that declares the property that this builder builds
-
contained
Controls if the property that is to be created should be contained in its owning instance. The default value for containment is true.- Parameters:
aValue
- boolean that specifies if the property is to be contained- Returns:
- this
-
collectionType
Sets the collection type for the property that is to be built. By default a property is single valued (CollectionType
isnull
).- Parameters:
aCollectionType
- the CollectionType object for the property- Returns:
- this
-
map
Marks the property to be built as aTLcdDataProperty.CollectionType.MAP
with the type as key type. The defaultCollectionType
isnull
.- Parameters:
aKeyType
- the type of the keys of this map- Returns:
- this
-
map
Marks the property to be built as aTLcdDataProperty.CollectionType.MAP
with the type with the given name as key type. The defaultCollectionType
isnull
.- Parameters:
aTypeName
- the name of a type of keys in the data model of this property's type- Returns:
- this
-
map
Marks the property to be built as aTLcdDataProperty.CollectionType.MAP
with the type of the given type builder as key type. The defaultCollectionType
isnull
.- Parameters:
aTypeBuilder
- a builder for the type that is to be used a key type- Returns:
- this
-
annotate
Adds an annotation to the property that is being built. The annotation can be retrieved on the property usingTLcdProperty.getAnnotation(Class<? extends ILcdAnnotation>)
.- Parameters:
aAnnotation
- the annotation to add- Returns:
- this
-
annotateFromFactory
public TLcdDataPropertyBuilder annotateFromFactory(TLcdDataPropertyBuilder.PropertyAnnotationFactory<?> aAnnotationFactory) Annotates the data property that is being built. The actual annotation is the return value of
TLcdDataPropertyBuilder.PropertyAnnotationFactory.createAnnotation(TLcdDataProperty)
. Once the data model is created, the annotation can be retrieved usingTLcdDataProperty.getAnnotation(Class)
.The use of the factory makes it possible to refer to the property from inside the annotation. The actual annotation value will be created at the end of the initialization of the data model.
- Parameters:
aAnnotationFactory
- a factory that is able to create the value of the annotation- Returns:
- this
-