public final class FeatureModelBuilder extends Object implements AutoCloseable
IFeatureModel
given a list of features, a model metadata, a feature model metadata and optionally a bounds.Constructor and Description |
---|
FeatureModelBuilder(FeatureModelBuilder other) |
Modifier and Type | Method and Description |
---|---|
FeatureModelBuilder |
bounds(Bounds bounds)
Sets the bounds of the feature model.
|
IFeatureModel |
build()
Creates a new in-memory
IFeatureModel instance, based on the given model metadata, feature model metadata and the list of features. |
void |
close() |
FeatureModelBuilder |
editable(boolean editable)
Sets whether the model should be editable or not.
|
FeatureModelBuilder |
featureModelMetadata(FeatureModelMetadata featureModelMetadata)
Sets the
FeatureModelMetadata of the feature model. |
FeatureModelBuilder |
features(List<Feature> features)
Sets the features of the feature model.
|
protected void |
finalize() |
FeatureModelBuilder |
modelMetadata(ModelMetadata modelMetadata)
Sets the
ModelMetadata of the feature model. |
static FeatureModelBuilder |
newBuilder()
Returns the builder class for creation of the
IFeatureModel . |
public FeatureModelBuilder(@NotNull FeatureModelBuilder other)
public void close()
close
in interface AutoCloseable
@NotNull public static FeatureModelBuilder newBuilder()
IFeatureModel
.IFeatureModel
.@NotNull public IFeatureModel build() throws IllegalStateException
IFeatureModel
instance, based on the given model metadata, feature model metadata and the list of features.
Depending on whether the editable
flag was set, it is possible to add/remove or update the features of this model after it has been created.
IFeatureModel
instance.IllegalStateException
- If not all mandatory parameters are set.@NotNull public FeatureModelBuilder bounds(@NotNull Bounds bounds) throws NullPointerException
Calling this function is optional.
If no bounds are provided, the model will attempt to derive the bounds by itself. It does so by calculating the union of the geometries of its features, as specified by Feature#findGeometry
.
bounds
- The model bounds. Cannot be null
.NullPointerException
- when passing null
.@NotNull public FeatureModelBuilder featureModelMetadata(@NotNull FeatureModelMetadata featureModelMetadata)
FeatureModelMetadata
of the feature model.
Calling this function is mandatory.
featureModelMetadata
- The model feature model metadata.@NotNull public FeatureModelBuilder features(@NotNull List<Feature> features)
Calling this function is optional.
The given features may or may not have an id assigned
. If an id is missing, an id will be assigned to them by the resulting model.
features
- The model features.@NotNull public FeatureModelBuilder modelMetadata(@NotNull ModelMetadata modelMetadata)
ModelMetadata
of the feature model.
Calling this function is mandatory.
modelMetadata
- The model metadata.@NotNull public FeatureModelBuilder editable(boolean editable)
An editable model exposes an IFeatureModelUpdater
, through which you can add, remove or update the model's features. Calling this function is optional. By default, this value is false.
editable
- whether the model should be editable or not.