LuciadCPillar C# 2024.0.02
Luciad.Datamodels.DataType.Builder Class Reference

Builder that allows DataType instances to be created. More...

Inheritance diagram for Luciad.Datamodels.DataType.Builder:

Public Member Functions

 Builder (Luciad.Datamodels.DataType.Builder other)
 
Luciad.Datamodels.DataType.Builder AddAnnotation (Luciad.Datamodels.DataAnnotation annotation)
 The annotation to add to the data type under construction. More...
 
Luciad.Datamodels.DataType.Builder AddAnnotation (Luciad.Datamodels.IDataAnnotationFactory annotationFactory)
 Adds an annotation factory that is invoked when build is called. More...
 
Luciad.Datamodels.DataType.Builder AddProperty (Luciad.Datamodels.DataProperty property)
 The property to add to the data type under construction. More...
 
Luciad.Datamodels.DataType Build ()
 Build the data type, including the properties and annotations that were added to this builder. More...
 
void Dispose ()
 
Luciad.Datamodels.DataType.Builder Name (string name)
 The name of the new data type. More...
 

Detailed Description

Builder that allows DataType instances to be created.

Typical usage would be create a DataType.Builder using DataType.NewBuilder, specifying the data type's name. Then add the necessary DataProperty(s) and finally build() the data type. The following snippet shows how this is done for a simple example data type:

.Name("TestDataType")
.AddProperty(someProperty)
.AddProperty(geometryProperty)
.AddAnnotation(new GeometryDataAnnotationFactory(geometryProperty))
.Build();
A representation of the type of a data object.
Definition: DataType.cs:26
static Luciad.Datamodels.DataType.Builder NewBuilder()
Creates a new DataType builder.
Definition: DataType.cs:63
string Name
The name of this data type.
Definition: DataType.cs:251

Constructor & Destructor Documentation

◆ Builder()

Luciad.Datamodels.DataType.Builder.Builder ( Luciad.Datamodels.DataType.Builder  other)
inline

Member Function Documentation

◆ AddAnnotation() [1/2]

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddAnnotation ( Luciad.Datamodels.DataAnnotation  annotation)
inline

The annotation to add to the data type under construction.

Parameters
annotationthe annotation to add to the data type under construction.
Returns
this builder.
Exceptions
System.ArgumentNullExceptionwhen a null value is passed.

◆ AddAnnotation() [2/2]

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddAnnotation ( Luciad.Datamodels.IDataAnnotationFactory  annotationFactory)
inline

Adds an annotation factory that is invoked when build is called.

The factory is provided with the type that is being built. This can be useful when the created annotation needs access to the type, for instance when the annotation requires a DataPropertyPath.

An example usage is:

public sealed class GeometryDataAnnotationFactory : IDataAnnotationFactory
{
public GeometryDataAnnotationFactory(DataProperty property)
{
if (property == null)
{
throw new ArgumentNullException("GeometryDataAnnotationFactory does not accept null DataProperty instances in its constructor");
}
Property = property;
}
public DataAnnotation CreateAnnotation(DataType dataType)
{
return new GeometryDataAnnotation(DataPropertyPath.NewBuilder().OriginType(dataType).Property(Property).Build());
}
private readonly DataProperty Property;
}
Application-specific metadata that can be added to parts of a data model.
Definition: DataAnnotation.cs:15
Represents a property of a DataType.
Definition: DataProperty.cs:21
Describes the path to a DataProperty in a DataType.
Definition: DataPropertyPath.cs:17
Luciad.Datamodels.DataType OriginType
The type of data object that this path accesses.
Definition: DataPropertyPath.cs:101
static Luciad.Datamodels.DataPropertyPath.Builder NewBuilder()
Creates a new builder.
Definition: DataPropertyPath.cs:54
DataAnnotation that is added on a DataType to define which property path contains the main geometry.
Definition: GeometryDataAnnotation.cs:18
Factory that can create a DataAnnotation based on a complete DataType.
Definition: IDataAnnotationFactory.cs:17
var geometryProperty = DataProperty.NewBuilder().Name("geometry").ValueType(DataType.GeometryType).Build();
var dataType = DataType.NewBuilder()
.Name("MyType")
.AddProperty(geometryProperty)
.AddAnnotation(new GeometryDataAnnotationFactory(geometryProperty))
.Build();
static Luciad.Datamodels.DataProperty.Builder NewBuilder()
Creates a new DataProperty builder.
Definition: DataProperty.cs:58
string Name
The name of the data property.
Definition: DataProperty.cs:84
static Luciad.Datamodels.DataType GeometryType
The type that corresponds to Geometry values.
Definition: DataType.cs:167
Parameters
annotationFactorythe factory object.
Returns
this builder.
Exceptions
System.ArgumentNullExceptionwhen a null value is passed.

◆ AddProperty()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddProperty ( Luciad.Datamodels.DataProperty  property)
inline

The property to add to the data type under construction.

Parameters
propertythe property to add to the data type under construction.
Returns
this builder.

◆ Build()

Luciad.Datamodels.DataType Luciad.Datamodels.DataType.Builder.Build ( )
inline

Build the data type, including the properties and annotations that were added to this builder.

After calling this function, this builder should no longer be used.

Returns
the data type.
Exceptions
System.InvalidOperationExceptionIf not all mandatory parameters are set.

◆ Dispose()

void Luciad.Datamodels.DataType.Builder.Dispose ( )
inline

◆ Name()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.Name ( string  name)
inline

The name of the new data type.

Calling this function is mandatory.

Parameters
namename of the new data type.
Returns
this builder.