Class FeatureModelUpdate.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
FeatureModelUpdate
Builder that allows FeatureModelUpdate instances to be created.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddFeature(Feature newFeature) Adds the givenFeatureto the model.build()Build theFeatureModelUpdateinstance.voidclose()protected voidfinalize()removeFeature(long featureId) Removes the feature with the given id from the model.updateFeature(Feature newFeature) This method is called to replace theFeaturewith the same id.updaterCallback(IFeatureUpdaterCallback updaterCallback) Sets the callback that must be called byIFeatureModelUpdater#updateto 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:
closein interfaceAutoCloseable
-
build
Build theFeatureModelUpdateinstance.- Returns:
- the feature model update.
-
updaterCallback
@NotNull public FeatureModelUpdate.Builder updaterCallback(@Nullable IFeatureUpdaterCallback updaterCallback) Sets the callback that must be called byIFeatureModelUpdater#updateto 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 givenFeatureto the model.This
Featuremay not have an id yet. In that case,IFeatureModelUpdater#updateis responsible forassigningan 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
Featurecan for example be useful for in-memory models likeFeatureModelBuilder, where the caller may want to assign id's to features. If aFeaturewith an id is passed to this method, the id must be unique.When adding the feature is finished, the given
callbackshould becalledwith the newly addedFeature(with id). When theFeaturecould 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 theFeaturewith 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
-