Class FeatureModelUpdate.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
FeatureModelUpdate
Builder
that allows FeatureModelUpdate
instances to be created.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddFeature
(Feature newFeature) Adds the givenFeature
to the model.build()
Build theFeatureModelUpdate
instance.void
close()
protected void
finalize()
removeFeature
(long featureId) Removes the feature with the given id from the model.updateFeature
(Feature newFeature) This method is called to replace theFeature
with the same id.updaterCallback
(IFeatureUpdaterCallback updaterCallback) Sets the callback that must be called byIFeatureModelUpdater#update
to inform that this update was successful or not, or to notify that features were added.
-
Constructor Details
-
Builder
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
build
Build theFeatureModelUpdate
instance.- Returns:
- the feature model update.
- Throws:
IllegalStateException
- If no changes were configured.
-
updaterCallback
@NotNull public FeatureModelUpdate.Builder updaterCallback(@Nullable IFeatureUpdaterCallback updaterCallback) Sets the callback that must be called byIFeatureModelUpdater#update
to inform that this update was successful or not, or to notify that features were added.This method is optional. If it's not set, a default callback which logs failures is used.
- Parameters:
updaterCallback
- the updater callback- Returns:
- this builder
-
addFeature
Adds the givenFeature
to the model.This
Feature
may not have an id yet. In that case,IFeatureModelUpdater#update
is responsible forassigning
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 likeFeatureModelBuilder
, where the caller may want to assign id's to features. If aFeature
with an id is passed to this method, the id must be unique.When adding the feature is finished, the given
callback
should becalled
with the newly addedFeature
(with id). When theFeature
could not be added, the callback should be called as well tonotify this
.- Parameters:
newFeature
- the newFeature
- Returns:
- this builder
-
updateFeature
This method is called to replace theFeature
with the same id.- Parameters:
newFeature
- the newFeature
- Returns:
- this builder
-
removeFeature
Removes the feature with the given id from the model.- Parameters:
featureId
- a feature id- Returns:
- this builder
-