Package org.eclipse.ditto.things.model
Interface FeatureBuilder.FromCopyBuildable
- Enclosing interface:
- FeatureBuilder
@NotThreadSafe
public static interface FeatureBuilder.FromCopyBuildable
A mutable builder with a fluent API for an immutable
Feature. This builder is initialised with the
properties of an existing Feature.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a new Feature object based on the data which was provided to this builder.definition(FeatureDefinition featureDefinition) Sets the specified Definition to the Feature to be built.desiredProperties(UnaryOperator<FeatureProperties> transform) Calls the giventransformfunction with the currently set desired properties of this builder.desiredProperties(org.eclipse.ditto.json.JsonObject desiredProperties) Sets the desired properties of the Feature.desiredProperties(FeatureProperties desiredProperties) Sets the desired properties of the Feature.properties(Function<FeatureProperties, FeatureProperties> transform) Calls the giventransformfunction with the currently set properties of this builder.properties(org.eclipse.ditto.json.JsonObject properties) Sets the properties of the Feature.properties(FeatureProperties properties) Sets the properties of the Feature.default FeatureBuilder.FromCopyBuildableSets the given Feature ID to this builder.Sets the given Feature ID to this builder.
-
Method Details
-
definition
Sets the specified Definition to the Feature to be built.- Parameters:
featureDefinition- the Definition to be set ornull.- Returns:
- this builder to allow method chaining.
-
properties
Sets the properties of the Feature.- Parameters:
properties- the properties of the Feature to be created ornull.- Returns:
- this builder to allow method chaining.
-
properties
Sets the properties of the Feature.- Parameters:
properties- the properties of the Feature to be created ornull.- Returns:
- this builder to allow method chaining.
-
properties
FeatureBuilder.FromCopyBuildable properties(Function<FeatureProperties, FeatureProperties> transform) Calls the giventransformfunction with the currently set properties of this builder. The result of thetransformfunction is set as new properties of the Feature to be built.- Parameters:
transform- the function to transform the current properties of the Feature to be created. If there are no properties set yet, the function is called with empty properties.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iftransformisnull.
-
desiredProperties
Sets the desired properties of the Feature.- Parameters:
desiredProperties- the desired properties of the Feature to be created ornull.- Returns:
- this builder to allow method chaining.
- Since:
- 1.5.0
-
desiredProperties
FeatureBuilder.FromCopyBuildable desiredProperties(@Nullable org.eclipse.ditto.json.JsonObject desiredProperties) Sets the desired properties of the Feature.- Parameters:
desiredProperties- the desired properties of the Feature to be created ornull.- Returns:
- this builder to allow method chaining.
- Since:
- 1.5.0
-
desiredProperties
Calls the giventransformfunction with the currently set desired properties of this builder. The result of thetransformfunction is set as new desired properties of the Feature to be built.- Parameters:
transform- the function to transform the current desired properties of the Feature to be created. If there are no desired properties set yet, the function is called with empty desired properties.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iftransformisnull.- Since:
- 1.5.0
-
setId
Sets the given Feature ID to this builder.- Parameters:
featureId- the Feature ID to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureIdisnull.IllegalArgumentException- iffeatureIdis empty.
-
setId
Sets the given Feature ID to this builder.- Parameters:
existingIdPredicate- a predicate to decide whether the given ID is set. The predicate receives the currently set Feature ID.featureId- the Feature ID to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.IllegalArgumentException- iffeatureIdis empty.
-
build
Feature build()Creates a new Feature object based on the data which was provided to this builder.- Returns:
- a new Feature object.
-