Package org.eclipse.ditto.things.model
Interface FeaturesBuilder
A mutable builder for a
Feature with a fluent API.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a newFeaturesobject containing all features which were set to this builder beforehand.get(CharSequence featureId) Returns the Feature with the specified identifier from this builder or an empty Optional if such a Feature is unknown to this builder.Removes the Feature with the given ID from this builder.Removes the given Feature from this builder.Removes all previously set Features.Sets the given Feature to this builder.Sets all given Features to this builder.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
set
Sets the given Feature to this builder. A previously set Feature with the same ID is replaced.- Parameters:
feature- the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureisnull.
-
get
Returns the Feature with the specified identifier from this builder or an empty Optional if such a Feature is unknown to this builder.- Parameters:
featureId- the identifier of the Feature to be returned.- Returns:
- the Feature with ID
featureIdor an empty Optional.
-
setAll
Sets all given Features to this builder. Each previously set feature with the same ID is replaced.- Parameters:
features- the Features to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeaturesisnull.
-
remove
Removes the given Feature from this builder. Same likeremove(String).- Parameters:
feature- the Feature to be removed.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureisnull.
-
remove
Removes the Feature with the given ID from this builder.- Parameters:
featureId- the ID of the Feature to be removed.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureIdisnull.
-
removeAll
FeaturesBuilder removeAll()Removes all previously set Features.- Returns:
- this builder to allow method chaining.
-
build
Features build()Creates a newFeaturesobject containing all features which were set to this builder beforehand.- Returns:
- the new
Featuresobject.
-