public static final class DataModel.Builder extends Object implements AutoCloseable
Builder
that allows DataModel
instances to be created.
Typical usage would be to create a DataModel.Builder
using DataModel#newBuilder
, specifying the data model's name. Then add the necessary DataType(s) and finally build()
the DataModel
. The following snippet shows how this is done for a simple example data model:
return DataModel.newBuilder()
.name("http://www.mydomain.com/datamodel/TestFeatureModel")
.addDataType(dataType)
.build();
Constructor and Description |
---|
Builder(DataModel.Builder other) |
Modifier and Type | Method and Description |
---|---|
DataModel.Builder |
addDataType(DataType type)
Adds a
DataType to the data model under construction. |
DataModel |
build()
Build the data model, including the types that were added to this builder.
|
void |
close() |
protected void |
finalize() |
DataModel.Builder |
name(String name)
Sets the name for the data model.
|
public Builder(@NotNull DataModel.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public DataModel build() throws IllegalStateException
After calling this function, this builder should no longer be used.
IllegalStateException
- If not all mandatory parameters are set.@NotNull public DataModel.Builder addDataType(@NotNull DataType type)
DataType
to the data model under construction.type
- the DataType
to add to the data model under construction.@NotNull public DataModel.Builder name(@NotNull String name)
Calling this function is mandatory.
name
- the name for the data model.