Package org.eclipse.ditto.things.model
Interface ThingBuilder.FromCopy
- Enclosing interface:
- ThingBuilder
@NotThreadSafe
public static interface ThingBuilder.FromCopy
A mutable builder with a fluent API for an immutable
Thing. This builder is initialised with the
properties of an existing Thing.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a new Thing object based on the data which was provided to this builder.default ThingBuilder.FromCopyRemoves all attributes from this builder.removeAllAttributes(Predicate<Attributes> existingAttributesPredicate) Removes all attributes from this builder.default ThingBuilder.FromCopyRemoves all features from this builder.removeAllFeatures(Predicate<Features> existingFeaturesPredicate) Removes all features from this builder.removeAttribute(Predicate<Attributes> existingAttributesPredicate, org.eclipse.ditto.json.JsonPointer attributePath) Removes the attribute at the given path from this builder.default ThingBuilder.FromCopyremoveAttribute(org.eclipse.ditto.json.JsonPointer attributePath) Removes the attribute at the given path from this builder.Removes the ThingDefinition from this builder.default ThingBuilder.FromCopyremoveFeature(String featureId) Removes the Feature with the given ID from this builder.removeFeature(Predicate<Features> existingFeaturesPredicate, String featureId) Removes the Feature with the given ID from this builder.removeFeatureDefinition(String featureId) Removes the definition from Feature with the given identifier on this builder.default ThingBuilder.FromCopyremoveFeatureDesiredProperties(CharSequence featureId) Removes all desired properties from the Feature with the given ID on this builder.removeFeatureDesiredProperties(Predicate<Features> existingFeaturesPredicate, CharSequence featureId) Removes all desired properties from the Feature with the given ID on this builder.default ThingBuilder.FromCopyremoveFeatureDesiredProperty(CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath) Removes the given desired property from the Feature with the given ID on this builder.removeFeatureDesiredProperty(Predicate<Features> existingFeaturesPredicate, CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath) Removes the given desired property from the Feature with the given ID on this builder.default ThingBuilder.FromCopyremoveFeatureProperties(String featureId) Removes all properties from the Feature with the given ID on this builder.removeFeatureProperties(Predicate<Features> existingFeaturesPredicate, String featureId) Removes all properties from the Feature with the given ID on this builder.default ThingBuilder.FromCopyremoveFeatureProperty(String featureId, org.eclipse.ditto.json.JsonPointer propertyPath) Removes the given property from the Feature with the given ID on this builder.removeFeatureProperty(Predicate<Features> existingFeaturesPredicate, String featureId, org.eclipse.ditto.json.JsonPointer propertyPath) Removes the given property from the Feature with the given ID on this builder.Removes the Policy ID from this builder.setAttribute(Predicate<Attributes> existingAttributesPredicate, org.eclipse.ditto.json.JsonPointer attributePath, org.eclipse.ditto.json.JsonValue attributeValue) Sets the given attribute to this builder.default ThingBuilder.FromCopysetAttribute(org.eclipse.ditto.json.JsonPointer attributePath, org.eclipse.ditto.json.JsonValue attributeValue) Sets the given attribute to this builder.default ThingBuilder.FromCopysetAttributes(String attributesJsonString) Sets the attributes to this builder.setAttributes(Predicate<Attributes> existingAttributesPredicate, String attributesJsonString) Sets the attributes to this builder.setAttributes(Predicate<Attributes> existingAttributesPredicate, org.eclipse.ditto.json.JsonObject attributesJsonObject) Sets the attributes to this builder.setAttributes(Predicate<Attributes> existingAttributesPredicate, Attributes attributes) Sets the given attributes to this builder.default ThingBuilder.FromCopysetAttributes(org.eclipse.ditto.json.JsonObject attributesJsonObject) Sets the attributes to this builder.default ThingBuilder.FromCopysetAttributes(Attributes attributes) Sets the given attributes to this builder.default ThingBuilder.FromCopysetCreated(Instant created) Sets the given created timestamp to this builder.setCreated(Predicate<Instant> existingCreatedPredicate, Instant created) Sets the given created timestamp to this builder.setDefinition(ThingDefinition definition) Sets the given definition to this builder.default ThingBuilder.FromCopysetFeature(CharSequence featureId, FeatureDefinition featureDefinition, FeatureProperties featureProperties, FeatureProperties featureDesiredProperties) Sets a Feature with the given ID and properties to this builder.default ThingBuilder.FromCopysetFeature(String featureId) Sets a Feature with the given ID to this builder.default ThingBuilder.FromCopysetFeature(String featureId, FeatureDefinition featureDefinition, FeatureProperties featureProperties) Sets a Feature with the given ID and properties to this builder.default ThingBuilder.FromCopysetFeature(String featureId, FeatureProperties featureProperties) Sets a Feature with the given ID and properties to this builder.setFeature(Predicate<Features> existingFeaturesPredicate, CharSequence featureId, FeatureDefinition featureDefinition, FeatureProperties featureProperties, FeatureProperties featureDesiredProperties) Sets a Feature with the given ID and properties to this builder.setFeature(Predicate<Features> existingFeaturesPredicate, String featureId) Sets a Feature with the given ID to this builder.setFeature(Predicate<Features> existingFeaturesPredicate, String featureId, FeatureDefinition featureDefinition, FeatureProperties featureProperties) Sets a Feature with the given ID and properties to this builder.setFeature(Predicate<Features> existingFeaturesPredicate, String featureId, FeatureProperties featureProperties) Sets a Feature with the given ID and properties to this builder.setFeature(Predicate<Features> existingFeaturesPredicate, Feature feature) Sets the given Feature to this builder.default ThingBuilder.FromCopysetFeature(Feature feature) Sets the given Feature to this builder.default ThingBuilder.FromCopysetFeatureDefinition(String featureId, FeatureDefinition featureDefinition) Sets the given definition to the Feature with the given ID on this builder.setFeatureDefinition(Predicate<Features> existingFeaturesPredicate, String featureId, FeatureDefinition featureDefinition) Sets the given definition to the Feature with the given ID on this builder.default ThingBuilder.FromCopysetFeatureDesiredProperties(CharSequence featureId, FeatureProperties desiredFeatureProperties) Sets the given desired properties to the Feature with the given ID on this builder.setFeatureDesiredProperties(Predicate<Features> existingFeaturesPredicate, CharSequence featureId, FeatureProperties desiredFeatureProperties) Sets the given desired properties to the Feature with the given ID on this builder.default ThingBuilder.FromCopysetFeatureDesiredProperty(CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath, org.eclipse.ditto.json.JsonValue desiredPropertyValue) Sets the given desired property to the Feature with the given ID on this builder.setFeatureDesiredProperty(Predicate<Features> existingFeaturesPredicate, CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath, org.eclipse.ditto.json.JsonValue desiredPropertyValue) Sets the given desired property to the Feature with the given ID on this builder.default ThingBuilder.FromCopysetFeatureProperties(String featureId, FeatureProperties featureProperties) Sets the given properties to the Feature with the given ID on this builder.setFeatureProperties(Predicate<Features> existingFeaturesPredicate, String featureId, FeatureProperties featureProperties) Sets the given properties to the Feature with the given ID on this builder.default ThingBuilder.FromCopysetFeatureProperty(String featureId, org.eclipse.ditto.json.JsonPointer propertyPath, org.eclipse.ditto.json.JsonValue propertyValue) Sets the given property to the Feature with the given ID on this builder.setFeatureProperty(Predicate<Features> existingFeaturesPredicate, String featureId, org.eclipse.ditto.json.JsonPointer propertyPath, org.eclipse.ditto.json.JsonValue propertyValue) Sets the given property to the Feature with the given ID on this builder.default ThingBuilder.FromCopysetFeatures(Iterable<Feature> features) Sets the given Features to this builder.default ThingBuilder.FromCopysetFeatures(String featuresJsonString) Sets the Features of the Thing based on the given JSON object.setFeatures(Predicate<Features> existingFeaturesPredicate, Iterable<Feature> features) Sets the given Features to this builder.setFeatures(Predicate<Features> existingFeaturesPredicate, String featuresJsonString) Sets the Features of the Thing based on the given JSON object.setFeatures(Predicate<Features> existingFeaturesPredicate, org.eclipse.ditto.json.JsonObject featuresJsonObject) Sets the features to this builder.default ThingBuilder.FromCopysetFeatures(org.eclipse.ditto.json.JsonObject featuresJsonObject) Sets the features to this builder.default ThingBuilder.FromCopySets a generated Thing ID to this builder.setGeneratedId(Predicate<ThingId> existingIdPredicate) Sets a generated Thing ID to this builder.Sets the given Thing ID to this builder.default ThingBuilder.FromCopySets the given Thing ID to this builder.setLifecycle(Predicate<ThingLifecycle> existingLifecyclePredicate, ThingLifecycle lifecycle) Sets the given lifecycle to this builder.default ThingBuilder.FromCopysetLifecycle(ThingLifecycle lifecycle) Sets the given lifecycle to this builder.setMetadata(Predicate<org.eclipse.ditto.base.model.entity.metadata.Metadata> existingMetadataPredicate, org.eclipse.ditto.base.model.entity.metadata.Metadata metadata) Sets the given metadata to this builder.default ThingBuilder.FromCopysetMetadata(org.eclipse.ditto.base.model.entity.metadata.Metadata metadata) Sets the given metadata to this builder.default ThingBuilder.FromCopysetModified(Instant modified) Sets the given modified to this builder.setModified(Predicate<Instant> existingModifiedPredicate, Instant modified) Sets the given modified timestamp to this builder.Sets attributes to this builder which represent semanticallynull.Sets the ThingDefinition to this builder which represent semanticallynull.Sets features to this builder which represents semanticallynull.setPolicyId(org.eclipse.ditto.policies.model.PolicyId policyId) Sets the given Policy ID to this builder.default ThingBuilder.FromCopysetRevision(long revisionNumber) Sets the given revision number to this builder.setRevision(Predicate<ThingRevision> existingRevisionPredicate, long revisionNumber) Sets the given revision number to this builder.setRevision(Predicate<ThingRevision> existingRevisionPredicate, ThingRevision revision) Sets the given revision to this builder.default ThingBuilder.FromCopysetRevision(ThingRevision revision) Sets the given revision to this builder.
-
Method Details
-
setPolicyId
Sets the given Policy ID to this builder.- Parameters:
policyId- the Policy ID to set.- Returns:
- this builder to allow method chaining.
-
removePolicyId
ThingBuilder.FromCopy removePolicyId()Removes the Policy ID from this builder.- Returns:
- this builder to allow method chaining.
-
setAttributes
Sets the given attributes to this builder.- Parameters:
attributes- the attributes to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifattributesisnull.
-
setAttributes
ThingBuilder.FromCopy setAttributes(Predicate<Attributes> existingAttributesPredicate, Attributes attributes) Sets the given attributes to this builder.- Parameters:
existingAttributesPredicate- a predicate to decide whether the given attributes are set. The predicate receives the currently set attributes.attributes- the attributes to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setAttributes
Sets the attributes to this builder. The attributes are parsed from the given JSON object representation ofAttributes.- Parameters:
attributesJsonObject- the JSON object representation of the attributes to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifattributesJsonObjectisnull.
-
setAttributes
ThingBuilder.FromCopy setAttributes(Predicate<Attributes> existingAttributesPredicate, org.eclipse.ditto.json.JsonObject attributesJsonObject) Sets the attributes to this builder. The attributes are parsed from the given JSON object representation ofAttributes.- Parameters:
existingAttributesPredicate- a predicate to decide whether the given attributes are set. The predicate receives the currently set attributes.attributesJsonObject- the JSON object representation of the attributes to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setAttributes
Sets the attributes to this builder. The attributes are parsed from the given JSON string representation ofAttributes.- Parameters:
attributesJsonString- JSON string representation of the attributes to be set.- Returns:
- this builder to allow method chaining.
- Throws:
org.eclipse.ditto.base.model.exceptions.DittoJsonException- ifattributesJsonStringis not a valid JSON object.
-
setAttributes
ThingBuilder.FromCopy setAttributes(Predicate<Attributes> existingAttributesPredicate, String attributesJsonString) Sets the attributes to this builder. The attributes are parsed from the given JSON string representation ofAttributes.- Parameters:
existingAttributesPredicate- a predicate to decide whether the given attributes are set. The predicate receives the currently set attributes.attributesJsonString- JSON string representation of the attributes to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifexistingAttributesPredicateisnull.org.eclipse.ditto.base.model.exceptions.DittoJsonException- ifattributesJsonStringis not a valid JSON object.
-
removeAllAttributes
Removes all attributes from this builder.- Returns:
- this builder to allow method chaining.
-
removeAllAttributes
Removes all attributes from this builder.- Parameters:
existingAttributesPredicate- a predicate to decide whether the given attributes are set. The predicate receives the currently set attributes.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifexistingAttributesPredicateisnull.
-
setNullAttributes
ThingBuilder.FromCopy setNullAttributes()Sets attributes to this builder which represent semanticallynull. All already set attributes are discarded.- Returns:
- this builder to allow method chaining.
-
setAttribute
default ThingBuilder.FromCopy setAttribute(org.eclipse.ditto.json.JsonPointer attributePath, org.eclipse.ditto.json.JsonValue attributeValue) Sets the given attribute to this builder.- Parameters:
attributePath- the hierarchical path to the attribute value.attributeValue- the value to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.IllegalArgumentException- ifattributePathis empty.
-
setAttribute
ThingBuilder.FromCopy setAttribute(Predicate<Attributes> existingAttributesPredicate, org.eclipse.ditto.json.JsonPointer attributePath, org.eclipse.ditto.json.JsonValue attributeValue) Sets the given attribute to this builder.- Parameters:
existingAttributesPredicate- a predicate to decide whether the given attributes are set. The predicate receives the currently set attributes.attributePath- the hierarchical path to the attribute value.attributeValue- the value to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.IllegalArgumentException- ifattributePathis empty.
-
removeAttribute
Removes the attribute at the given path from this builder.- Parameters:
attributePath- the hierarchical path to the attribute to be removed.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifattributePathisnull.
-
removeAttribute
ThingBuilder.FromCopy removeAttribute(Predicate<Attributes> existingAttributesPredicate, org.eclipse.ditto.json.JsonPointer attributePath) Removes the attribute at the given path from this builder.- Parameters:
existingAttributesPredicate- a predicate to decide whether the given attributes are set. The predicate receives the currently set attributes.attributePath- the hierarchical path to the attribute to be removed.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setDefinition
Sets the given definition to this builder.- Parameters:
definition- the Definition to set.- Returns:
- this builder to allow method chaining.
-
setNullDefinition
ThingBuilder.FromCopy setNullDefinition()Sets the ThingDefinition to this builder which represent semanticallynull. An already set definition is discarded.- Returns:
- this builder to allow method chaining.
-
removeDefinition
ThingBuilder.FromCopy removeDefinition()Removes the ThingDefinition from this builder.- Returns:
- this builder to allow method chaining.
-
setFeature
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.
-
setFeature
Sets the given Feature to this builder. A previously set Feature with the same ID is replaced.- Parameters:
existingFeaturesPredicate- a predicate which determines, based on the already set features, whether the provided Feature is set to the builder.feature- the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setFeature
Sets a Feature with the given ID to this builder. A previously set Feature with the same ID is replaced.- Parameters:
featureId- the ID of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureIdisnull.
-
setFeature
Sets a Feature with the given ID to this builder. A previously set Feature with the same ID is replaced.- Parameters:
existingFeaturesPredicate- a predicate which determines, based on the already set features, whether the provided Feature is set to the builder.featureId- the ID of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
removeFeature
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.
-
removeFeature
ThingBuilder.FromCopy removeFeature(Predicate<Features> existingFeaturesPredicate, String featureId) Removes the Feature with the given ID from this builder.- Parameters:
existingFeaturesPredicate- a predicate to decide whether the given features exist. The predicate receives the currently set features.featureId- the ID of the Feature to be removed.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setFeature
Sets a Feature with the given ID and properties to this builder. A previously set Feature with the same ID is replaced.- Parameters:
featureId- the ID of the Feature to be set.featureProperties- the properties of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureIdisnull.
-
setFeature
ThingBuilder.FromCopy setFeature(Predicate<Features> existingFeaturesPredicate, String featureId, FeatureProperties featureProperties) Sets a Feature with the given ID and properties to this builder. A previously set Feature with the same ID is replaced.- Parameters:
existingFeaturesPredicate- a predicate which determines, based on the already set features, whether the provided Feature is set to the builder.featureId- the ID of the Feature to be set.featureProperties- the properties of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setFeature
default ThingBuilder.FromCopy setFeature(String featureId, FeatureDefinition featureDefinition, FeatureProperties featureProperties) Sets a Feature with the given ID and properties to this builder. A previously set Feature with the same ID is replaced.- Parameters:
featureId- the ID of the Feature to be set.featureDefinition- the definition of the Feature to be set.featureProperties- the properties of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureIdisnull.
-
setFeature
default ThingBuilder.FromCopy setFeature(CharSequence featureId, FeatureDefinition featureDefinition, FeatureProperties featureProperties, FeatureProperties featureDesiredProperties) Sets a Feature with the given ID and properties to this builder. A previously set Feature with the same ID is replaced.- Parameters:
featureId- the ID of the Feature to be set.featureDefinition- the definition of the Feature to be set.featureProperties- the properties of the Feature to be set.featureDesiredProperties- the desired properties of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureIdisnull.- Since:
- 1.5.0
-
setFeature
ThingBuilder.FromCopy setFeature(Predicate<Features> existingFeaturesPredicate, String featureId, FeatureDefinition featureDefinition, FeatureProperties featureProperties) Sets a Feature with the given ID and properties to this builder. A previously set Feature with the same ID is replaced.- Parameters:
existingFeaturesPredicate- a predicate to decide whether the given features exist. The predicate receives the currently set features.featureId- the ID of the Feature to be set.featureDefinition- the definition of the Feature to be set.featureProperties- the properties of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setFeature
ThingBuilder.FromCopy setFeature(Predicate<Features> existingFeaturesPredicate, CharSequence featureId, FeatureDefinition featureDefinition, FeatureProperties featureProperties, FeatureProperties featureDesiredProperties) Sets a Feature with the given ID and properties to this builder. A previously set Feature with the same ID is replaced.- Parameters:
existingFeaturesPredicate- a predicate which determines, based on the already set features, whether the provided Feature is set to the builder.featureId- the ID of the Feature to be set.featureDefinition- the definition of the Feature to be set.featureProperties- the properties of the Feature to be set.featureDesiredProperties- the desired properties of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
setFeatureDefinition
default ThingBuilder.FromCopy setFeatureDefinition(String featureId, FeatureDefinition featureDefinition) Sets the given definition to the Feature with the given ID on this builder.- Parameters:
featureId- the ID of the Feature to be set.featureDefinition- the definition of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setFeatureDefinition
ThingBuilder.FromCopy setFeatureDefinition(Predicate<Features> existingFeaturesPredicate, String featureId, FeatureDefinition featureDefinition) Sets the given definition to the Feature with the given ID on this builder.- Parameters:
existingFeaturesPredicate- a predicate to decide whether the given definition is set. The predicate receives the currently set features.featureId- the ID of the Feature to be set.featureDefinition- the definition of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
removeFeatureDefinition
Removes the definition from Feature with the given identifier on this builder.- Parameters:
featureId- the ID of the Feature from which the definition is to be deleted.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureIdisnull.
-
setFeatureProperty
default ThingBuilder.FromCopy setFeatureProperty(String featureId, org.eclipse.ditto.json.JsonPointer propertyPath, org.eclipse.ditto.json.JsonValue propertyValue) Sets the given property to the Feature with the given ID on this builder.- Parameters:
featureId- the ID of the Feature.propertyPath- the hierarchical path within the Feature to the property to be set.propertyValue- the property value to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setFeatureProperty
ThingBuilder.FromCopy setFeatureProperty(Predicate<Features> existingFeaturesPredicate, String featureId, org.eclipse.ditto.json.JsonPointer propertyPath, org.eclipse.ditto.json.JsonValue propertyValue) Sets the given property to the Feature with the given ID on this builder.- Parameters:
existingFeaturesPredicate- a predicate to decide whether the given features exist. The predicate receives the currently set features.featureId- the ID of the Feature.propertyPath- the hierarchical path within the Feature to the property to be set.propertyValue- the property value to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
removeFeatureProperty
default ThingBuilder.FromCopy removeFeatureProperty(String featureId, org.eclipse.ditto.json.JsonPointer propertyPath) Removes the given property from the Feature with the given ID on this builder.- Parameters:
featureId- the ID of the Feature.propertyPath- the hierarchical path to within the Feature to the property to be removed.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
removeFeatureProperty
ThingBuilder.FromCopy removeFeatureProperty(Predicate<Features> existingFeaturesPredicate, String featureId, org.eclipse.ditto.json.JsonPointer propertyPath) Removes the given property from the Feature with the given ID on this builder.- Parameters:
existingFeaturesPredicate- a predicate which determines, based on the already set features, whether the provided feature property is removed from the builder.featureId- the ID of the Feature.propertyPath- the hierarchical path to within the Feature to the property to be removed.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setFeatureProperties
default ThingBuilder.FromCopy setFeatureProperties(String featureId, FeatureProperties featureProperties) Sets the given properties to the Feature with the given ID on this builder.- Parameters:
featureId- the ID of the Feature.featureProperties- the properties to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setFeatureProperties
ThingBuilder.FromCopy setFeatureProperties(Predicate<Features> existingFeaturesPredicate, String featureId, FeatureProperties featureProperties) Sets the given properties to the Feature with the given ID on this builder.- Parameters:
existingFeaturesPredicate- a predicate to decide whether the given features exist. The predicate receives the currently set features.featureId- the ID of the Feature.featureProperties- the properties to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
removeFeatureProperties
Removes all properties from the Feature with the given ID on this builder.- Parameters:
featureId- the ID of the Feature.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureIdisnull.
-
removeFeatureProperties
ThingBuilder.FromCopy removeFeatureProperties(Predicate<Features> existingFeaturesPredicate, String featureId) Removes all properties from the Feature with the given ID on this builder.- Parameters:
existingFeaturesPredicate- a predicate which determines, based on the already set features, whether the provided feature properties are removed from the builder.featureId- the ID of the Feature.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
setFeatureDesiredProperty
default ThingBuilder.FromCopy setFeatureDesiredProperty(CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath, org.eclipse.ditto.json.JsonValue desiredPropertyValue) Sets the given desired property to the Feature with the given ID on this builder.- Parameters:
featureId- the ID of the Feature.desiredPropertyPath- the hierarchical path within the Feature to the desired property to be set.desiredPropertyValue- the desired property value to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
setFeatureDesiredProperty
ThingBuilder.FromCopy setFeatureDesiredProperty(Predicate<Features> existingFeaturesPredicate, CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath, org.eclipse.ditto.json.JsonValue desiredPropertyValue) Sets the given desired property to the Feature with the given ID on this builder.- Parameters:
existingFeaturesPredicate- a predicate to decide whether the given features exist. The predicate receives the currently set features.featureId- the ID of the Feature.desiredPropertyPath- the hierarchical path within the Feature to the desired property to be set.desiredPropertyValue- the desired property value to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
removeFeatureDesiredProperty
default ThingBuilder.FromCopy removeFeatureDesiredProperty(CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath) Removes the given desired property from the Feature with the given ID on this builder.- Parameters:
featureId- the ID of the Feature.desiredPropertyPath- the hierarchical path to within the Feature to the desired property to be removed.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
removeFeatureDesiredProperty
ThingBuilder.FromCopy removeFeatureDesiredProperty(Predicate<Features> existingFeaturesPredicate, CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath) Removes the given desired property from the Feature with the given ID on this builder.- Parameters:
existingFeaturesPredicate- a predicate which determines, based on the already set features, whether the provided desired feature property is removed from the builder.featureId- the ID of the Feature.desiredPropertyPath- the hierarchical path to within the Feature to the desired property to be removed.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
setFeatureDesiredProperties
default ThingBuilder.FromCopy setFeatureDesiredProperties(CharSequence featureId, FeatureProperties desiredFeatureProperties) Sets the given desired properties to the Feature with the given ID on this builder.- Parameters:
featureId- the ID of the Feature.desiredFeatureProperties- the desired properties to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
setFeatureDesiredProperties
ThingBuilder.FromCopy setFeatureDesiredProperties(Predicate<Features> existingFeaturesPredicate, CharSequence featureId, FeatureProperties desiredFeatureProperties) Sets the given desired properties to the Feature with the given ID on this builder.- Parameters:
existingFeaturesPredicate- a predicate to decide whether the given features exist. The predicate receives the currently set features.featureId- the ID of the Feature.desiredFeatureProperties- the desired properties to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
removeFeatureDesiredProperties
Removes all desired properties from the Feature with the given ID on this builder.- Parameters:
featureId- the ID of the Feature.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeatureIdisnull.- Since:
- 1.5.0
-
removeFeatureDesiredProperties
ThingBuilder.FromCopy removeFeatureDesiredProperties(Predicate<Features> existingFeaturesPredicate, CharSequence featureId) Removes all desired properties from the Feature with the given ID on this builder.- Parameters:
existingFeaturesPredicate- a predicate which determines, based on the already set features, whether the provided desired feature properties are removed from the builder.featureId- the ID of the Feature.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
setFeatures
Sets the features to this builder. The features are parsed from the given JSON object representation ofFeatures.- Parameters:
featuresJsonObject- JSON object representation of the features to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeaturesJsonObjectisnull.org.eclipse.ditto.base.model.exceptions.DittoJsonException- iffeaturesJsonObjectcannot be parsed toFeatures.
-
setFeatures
ThingBuilder.FromCopy setFeatures(Predicate<Features> existingFeaturesPredicate, org.eclipse.ditto.json.JsonObject featuresJsonObject) Sets the features to this builder. The features are parsed from the given JSON object representation ofFeatures.- Parameters:
existingFeaturesPredicate- a predicate to decide whether the given features exist. The predicate receives the currently set features.featuresJsonObject- JSON object representation of the features to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.org.eclipse.ditto.base.model.exceptions.DittoJsonException- iffeaturesJsonObjectcannot be parsed toFeatures.
-
setFeatures
Sets the Features of the Thing based on the given JSON object.- Parameters:
featuresJsonString- JSON string providing the Features of the Thing.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeaturesJsonStringisnull.org.eclipse.ditto.base.model.exceptions.DittoJsonException- iffeaturesJsonStringcannot be parsed toFeatures.
-
setFeatures
ThingBuilder.FromCopy setFeatures(Predicate<Features> existingFeaturesPredicate, String featuresJsonString) Sets the Features of the Thing based on the given JSON object.- Parameters:
existingFeaturesPredicate- a predicate which determines, based on the already set features, whether the provided features are set to the builder.featuresJsonString- JSON string providing the Features of the Thing.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.org.eclipse.ditto.base.model.exceptions.DittoJsonException- iffeaturesJsonStringcannot be parsed toFeatures.
-
setFeatures
Sets the given Features to this builder.- Parameters:
features- the Features to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- iffeaturesisnull.
-
setFeatures
ThingBuilder.FromCopy setFeatures(Predicate<Features> existingFeaturesPredicate, Iterable<Feature> features) Sets the given Features to this builder.- Parameters:
existingFeaturesPredicate- a predicate to decide whether the given features exist. The predicate receives the currently set features.features- the Features to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- if any argument isnull.
-
removeAllFeatures
Removes all features from this builder.- Returns:
- this builder to allow method chaining.
-
removeAllFeatures
Removes all features from this builder.- Parameters:
existingFeaturesPredicate- a predicate which determines, based on the already set features, whether all features are removed from the builder.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifexistingFeaturesPredicateisnull.
-
setNullFeatures
ThingBuilder.FromCopy setNullFeatures()Sets features to this builder which represents semanticallynull. All already set features are discarded.- Returns:
- this builder to allow method chaining.
-
setLifecycle
Sets the given lifecycle to this builder.- Parameters:
lifecycle- the lifecycle to be set.- Returns:
- this builder to allow method chaining.
-
setLifecycle
ThingBuilder.FromCopy setLifecycle(Predicate<ThingLifecycle> existingLifecyclePredicate, @Nullable ThingLifecycle lifecycle) Sets the given lifecycle to this builder.- Parameters:
existingLifecyclePredicate- a predicate to decide whether the given lifecycle is set. The predicate receives the currently set lifecycle.lifecycle- the lifecycle to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifexistingLifecyclePredicateisnull.
-
setRevision
Sets the given revision to this builder.- Parameters:
revision- the revision to be set.- Returns:
- this builder to allow method chaining.
-
setRevision
ThingBuilder.FromCopy setRevision(Predicate<ThingRevision> existingRevisionPredicate, ThingRevision revision) Sets the given revision to this builder.- Parameters:
existingRevisionPredicate- a predicate to decide whether the given revision is set. The predicate receives the currently set revision.revision- the revision to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifexistingRevisionPredicateisnull.
-
setRevision
Sets the given revision number to this builder.- Parameters:
revisionNumber- the revision number to be set.- Returns:
- this builder to allow method chaining.
-
setRevision
ThingBuilder.FromCopy setRevision(Predicate<ThingRevision> existingRevisionPredicate, long revisionNumber) Sets the given revision number to this builder.- Parameters:
existingRevisionPredicate- a predicate to decide whether the given revision is set. The predicate receives the currently set revision.revisionNumber- the revision number to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifexistingRevisionPredicateisnull.
-
setModified
Sets the given modified to this builder.- Parameters:
modified- the modified to be set.- Returns:
- this builder to allow method chaining.
-
setModified
ThingBuilder.FromCopy setModified(Predicate<Instant> existingModifiedPredicate, @Nullable Instant modified) Sets the given modified timestamp to this builder.- Parameters:
existingModifiedPredicate- a predicate to decide whether the given modified timestamp is set. The predicate receives the currently set modified timestamp.modified- the modified timestamp to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifexistingModifiedPredicateisnull.
-
setCreated
Sets the given created timestamp to this builder.- Parameters:
created- the created timestamp to be set.- Returns:
- this builder to allow method chaining.
- Since:
- 1.2.0
-
setCreated
ThingBuilder.FromCopy setCreated(Predicate<Instant> existingCreatedPredicate, @Nullable Instant created) Sets the given created timestamp to this builder.- Parameters:
existingCreatedPredicate- a predicate to decide whether the given created timestamp is set. The predicate receives the currently set created timestamp.created- the created to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifexistingCreatedPredicateisnull.- Since:
- 1.2.0
-
setMetadata
default ThingBuilder.FromCopy setMetadata(@Nullable org.eclipse.ditto.base.model.entity.metadata.Metadata metadata) Sets the given metadata to this builder.- Parameters:
metadata- the metadata to be set.- Returns:
- this builder to allow method chaining.
- Since:
- 1.2.0
-
setMetadata
ThingBuilder.FromCopy setMetadata(Predicate<org.eclipse.ditto.base.model.entity.metadata.Metadata> existingMetadataPredicate, @Nullable org.eclipse.ditto.base.model.entity.metadata.Metadata metadata) Sets the given metadata to this builder.- Parameters:
existingMetadataPredicate- a predicate to decide whether the given metadata is set. The predicate receives the currently set metadata.metadata- the metadata to be set.- Returns:
- this builder to allow method chaining.
- Since:
- 1.2.0
-
setId
Sets the given Thing ID to this builder. The ID is required to include the Thing's namespace.- Parameters:
thingId- the Thing ID to be set.- Returns:
- this builder to allow method chaining.
- Throws:
ThingIdInvalidException- ifthingIddoes not comply to the required pattern.
-
setId
Sets the given Thing ID to this builder. The ID is required to include the Thing's namespace.- Parameters:
existingIdPredicate- a predicate to decide whether the given ID is set. The predicate receives the currently set Thing ID.thingId- the Thing ID to be set.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifexistingIdPredicateisnull.ThingIdInvalidException- ifthingIddoes not comply to the required pattern.
-
setGeneratedId
Sets a generated Thing ID to this builder.- Returns:
- this builder to allow method chaining.
-
setGeneratedId
Sets a generated Thing ID to this builder.- Parameters:
existingIdPredicate- a predicate to decide whether the given ID is set. The predicate receives the currently set Thing ID.- Returns:
- this builder to allow method chaining.
- Throws:
NullPointerException- ifexistingIdPredicateisnull.
-
build
Thing build()Creates a new Thing object based on the data which was provided to this builder.- Returns:
- a new Thing object.
-