public static final class FeatureModelUpdate.Builder extends Object implements AutoCloseable
Builder
that allows FeatureModelUpdate
instances to be created.Constructor and Description |
---|
Builder(FeatureModelUpdate.Builder other) |
Modifier and Type | Method and Description |
---|---|
FeatureModelUpdate.Builder |
addFeature(Feature newFeature)
Adds the given
Feature to the model. |
FeatureModelUpdate |
build()
Build the
FeatureModelUpdate instance. |
void |
close() |
protected void |
finalize() |
FeatureModelUpdate.Builder |
removeFeature(long featureId)
Removes the feature with the given id from the model.
|
FeatureModelUpdate.Builder |
updateFeature(Feature newFeature)
This method is called to replace the
Feature with the same id. |
FeatureModelUpdate.Builder |
updaterCallback(IFeatureUpdaterCallback updaterCallback)
Sets the callback that must be called by
IFeatureModelUpdater#update to inform that this update was successful or not, or to notify that features were added. |
public Builder(@NotNull FeatureModelUpdate.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public FeatureModelUpdate build() throws IllegalStateException
FeatureModelUpdate
instance.IllegalStateException
- If no changes were configured.@NotNull public FeatureModelUpdate.Builder updaterCallback(@Nullable IFeatureUpdaterCallback updaterCallback)
IFeatureModelUpdater#update
to inform that this update was successful or not, or to notify that features were added.
This method is optional.
updaterCallback
- the updater callback@NotNull public FeatureModelUpdate.Builder addFeature(@NotNull Feature newFeature)
Feature
to the model.
This Feature
may not have an id yet. In that case, IFeatureModelUpdater#update
is responsible for assigning
an id to the feature when adding it to the model. In general, callers of this method can not assign id's to Features.
There are a few exceptions though. Passing an id with Feature
can for example be useful for in-memory models like FeatureModelBuilder
, where the caller may want to assign id's to features. If a Feature
with an id is passed to this method, the id must be unique.
When adding the feature is finished, the given callback
should be called
with the newly added Feature
(with id). When the Feature
could not be added, the callback should be called as well to notify this
.
newFeature
- the new Feature
@NotNull public FeatureModelUpdate.Builder updateFeature(@NotNull Feature newFeature)
Feature
with the same id.newFeature
- the new Feature
@NotNull public FeatureModelUpdate.Builder removeFeature(long featureId)
featureId
- a feature id