Package org.eclipse.ditto.things.model
Interface ThingBuilder.FromScratch
-
- Enclosing interface:
- ThingBuilder
@NotThreadSafe public static interface ThingBuilder.FromScratchA mutable builder with a fluent API for an immutableThingfrom scratch.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Thingbuild()Creates a new immutableThingcontaining all properties which were set to this builder beforehand.ThingBuilder.FromScratchremoveAllAttributes()Removes all attributes from this builder.ThingBuilder.FromScratchremoveAllFeatures()Removes all features from this builder.ThingBuilder.FromScratchremoveAttribute(org.eclipse.ditto.json.JsonPointer attributePath)Removes the attribute at the given path from this builder.ThingBuilder.FromScratchremoveDefinition()Removes the Definition from this builder.ThingBuilder.FromScratchremoveFeature(java.lang.String featureId)Removes the Feature with the given ID from this builder.ThingBuilder.FromScratchremoveFeatureDefinition(java.lang.String featureId)Removes the definition from Feature with the given identifier on this builder.ThingBuilder.FromScratchremoveFeatureDesiredProperties(java.lang.CharSequence featureId)Removes all desired properties from the Feature with the given ID on this builder.ThingBuilder.FromScratchremoveFeatureDesiredProperty(java.lang.CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath)Removes the given desired property from the Feature with the given ID on this builder.ThingBuilder.FromScratchremoveFeatureProperties(java.lang.String featureId)Removes all properties from the Feature with the given ID on this builder.ThingBuilder.FromScratchremoveFeatureProperty(java.lang.String featureId, org.eclipse.ditto.json.JsonPointer propertyPath)Removes the given property from the Feature with the given ID on this builder.ThingBuilder.FromScratchremovePolicyId()Removes the Policy ID from this builder.ThingBuilder.FromScratchsetAttribute(org.eclipse.ditto.json.JsonPointer attributePath, org.eclipse.ditto.json.JsonValue attributeValue)Sets the given attribute to this builder.ThingBuilder.FromScratchsetAttributes(java.lang.String attributesJsonString)Sets the attributes to this builder.ThingBuilder.FromScratchsetAttributes(org.eclipse.ditto.json.JsonObject attributesJsonObject)Sets the attributes to this builder.ThingBuilder.FromScratchsetAttributes(Attributes attributes)Sets the given attributes to this builder.ThingBuilder.FromScratchsetCreated(java.time.Instant created)Sets the given created timestamp to this builder.ThingBuilder.FromScratchsetDefinition(ThingDefinition definition)Sets the given ThingDefinition to this builder.ThingBuilder.FromScratchsetEmptyAttributes()Sets empty attributes to this builder.ThingBuilder.FromScratchsetEmptyFeatures()Sets empty features to this builder.ThingBuilder.FromScratchsetFeature(java.lang.CharSequence featureId, FeatureDefinition featureDefinition, FeatureProperties featureProperties, FeatureProperties featureDesiredProperties)Sets a Feature with the given ID and properties to this builder.ThingBuilder.FromScratchsetFeature(java.lang.String featureId)Sets a Feature with the given ID to this builder.ThingBuilder.FromScratchsetFeature(java.lang.String featureId, FeatureDefinition featureDefinition, FeatureProperties featureProperties)Sets a Feature with the given ID and properties to this builder.ThingBuilder.FromScratchsetFeature(java.lang.String featureId, FeatureProperties featureProperties)Sets a Feature with the given ID and properties to this builder.ThingBuilder.FromScratchsetFeature(Feature feature)Sets the given Feature to this builder.ThingBuilder.FromScratchsetFeatureDefinition(java.lang.String featureId, FeatureDefinition featureDefinition)Sets the given definition to the Feature with the given ID on this builder.ThingBuilder.FromScratchsetFeatureDesiredProperties(java.lang.CharSequence featureId, FeatureProperties desiredFeatureProperties)Sets the given desired properties to the Feature with the given ID on this builder.ThingBuilder.FromScratchsetFeatureDesiredProperty(java.lang.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.ThingBuilder.FromScratchsetFeatureProperties(java.lang.String featureId, FeatureProperties featureProperties)Sets the given properties to the Feature with the given ID on this builder.ThingBuilder.FromScratchsetFeatureProperty(java.lang.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.ThingBuilder.FromScratchsetFeatures(java.lang.Iterable<Feature> features)Sets the given Features to this builder.ThingBuilder.FromScratchsetFeatures(java.lang.String featuresJsonString)Sets the Features of the Thing based on the given JSON object.ThingBuilder.FromScratchsetFeatures(org.eclipse.ditto.json.JsonObject featuresJsonObject)Sets the features to this builder.ThingBuilder.FromScratchsetGeneratedId()Sets a generated Thing ID to this builder.ThingBuilder.FromScratchsetId(ThingId thingId)Sets the given Thing ID to this builder.ThingBuilder.FromScratchsetLifecycle(ThingLifecycle lifecycle)Sets the given lifecycle to this builder.ThingBuilder.FromScratchsetMetadata(org.eclipse.ditto.base.model.entity.metadata.Metadata metadata)Sets the given Metadata to this builder.ThingBuilder.FromScratchsetModified(java.time.Instant modified)Sets the given modified timestamp to this builder.ThingBuilder.FromScratchsetNullAttributes()Sets attributes to this builder which represent semanticallynull.ThingBuilder.FromScratchsetNullDefinition()Sets the ThingDefinition to this builder which represent semanticallynull.ThingBuilder.FromScratchsetNullFeatures()Sets features to this builder which represents semanticallynull.ThingBuilder.FromScratchsetPolicyId(org.eclipse.ditto.policies.model.PolicyId policyId)Sets the given Policy ID to this builder.ThingBuilder.FromScratchsetRevision(long revisionNumber)Sets the given revision number to this builder.ThingBuilder.FromScratchsetRevision(ThingRevision revision)Sets the given revision to this builder.
-
-
-
Method Detail
-
setPolicyId
ThingBuilder.FromScratch setPolicyId(@Nullable org.eclipse.ditto.policies.model.PolicyId policyId)
Sets the given Policy ID to this builder.- Parameters:
policyId- the Policy ID to set.- Returns:
- this builder to allow method chaining.
-
removePolicyId
ThingBuilder.FromScratch removePolicyId()
Removes the Policy ID from this builder.- Returns:
- this builder to allow method chaining.
-
setAttributes
ThingBuilder.FromScratch setAttributes(Attributes attributes)
Sets the given attributes to this builder.- Parameters:
attributes- the attributes to be set.- Returns:
- this builder to allow method chaining.
- Throws:
java.lang.NullPointerException- ifattributesisnull.
-
setAttributes
ThingBuilder.FromScratch setAttributes(org.eclipse.ditto.json.JsonObject attributesJsonObject)
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:
java.lang.NullPointerException- ifattributesJsonObjectisnull.
-
setAttributes
ThingBuilder.FromScratch setAttributes(java.lang.String attributesJsonString)
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.
-
removeAllAttributes
ThingBuilder.FromScratch removeAllAttributes()
Removes all attributes from this builder.- Returns:
- this builder to allow method chaining.
-
setEmptyAttributes
ThingBuilder.FromScratch setEmptyAttributes()
Sets empty attributes to this builder. All already set attributes are discarded.- Returns:
- this builder to allow method chaining.
-
setNullAttributes
ThingBuilder.FromScratch setNullAttributes()
Sets attributes to this builder which represent semanticallynull. All already set attributes are discarded.- Returns:
- this builder to allow method chaining.
-
setAttribute
ThingBuilder.FromScratch 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:
java.lang.NullPointerException- if any argument isnull.java.lang.IllegalArgumentException- ifattributePathis empty.
-
removeAttribute
ThingBuilder.FromScratch removeAttribute(org.eclipse.ditto.json.JsonPointer attributePath)
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:
java.lang.NullPointerException- if attributes were set already andattributePathisnull.
-
setDefinition
ThingBuilder.FromScratch setDefinition(@Nullable ThingDefinition definition)
Sets the given ThingDefinition to this builder.- Parameters:
definition- the Definition to set.- Returns:
- this builder to allow method chaining.
-
setNullDefinition
ThingBuilder.FromScratch 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.FromScratch removeDefinition()
Removes the Definition from this builder.- Returns:
- this builder to allow method chaining.
-
setFeature
ThingBuilder.FromScratch setFeature(Feature feature)
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:
java.lang.NullPointerException- iffeatureisnull.
-
setFeature
ThingBuilder.FromScratch setFeature(java.lang.String featureId)
Sets a Feature with the given ID to this builder. A previously set Feature with the same ID is replaced.- Parameters:
featureId- the identifier of the Feature to be set.- Returns:
- this builder to allow method chaining.
- Throws:
java.lang.NullPointerException- iffeatureIdisnull.
-
setFeature
ThingBuilder.FromScratch setFeature(java.lang.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:
java.lang.NullPointerException- iffeatureIdisnull.
-
setFeature
ThingBuilder.FromScratch setFeature(java.lang.CharSequence featureId, @Nullable FeatureDefinition featureDefinition, @Nullable FeatureProperties featureProperties, @Nullable 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:
java.lang.NullPointerException- iffeatureIdisnull.- Since:
- 1.5.0
-
setFeature
ThingBuilder.FromScratch setFeature(java.lang.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:
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:
java.lang.NullPointerException- iffeatureIdisnull.
-
removeFeature
ThingBuilder.FromScratch removeFeature(java.lang.String featureId)
Removes the Feature with the given ID from this builder. If this was the last Feature the Thing will not have features.- Parameters:
featureId- the ID of the Feature to be removed.- Returns:
- this builder to allow method chaining.
- Throws:
java.lang.NullPointerException- iffeatureIdisnull.
-
setFeatureDefinition
ThingBuilder.FromScratch setFeatureDefinition(java.lang.String featureId, FeatureDefinition featureDefinition)
Sets the given definition to the Feature with the given ID on this builder. If this builder does not yet know a Feature with the given ID it creates one.- 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:
java.lang.NullPointerException- if any argument isnull.
-
removeFeatureDefinition
ThingBuilder.FromScratch removeFeatureDefinition(java.lang.String featureId)
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:
java.lang.NullPointerException- iffeatureIdisnull.
-
setFeatureProperty
ThingBuilder.FromScratch setFeatureProperty(java.lang.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:
java.lang.NullPointerException- if any argument isnull.
-
removeFeatureProperty
ThingBuilder.FromScratch removeFeatureProperty(java.lang.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:
java.lang.NullPointerException- if any argument isnull.
-
setFeatureProperties
ThingBuilder.FromScratch setFeatureProperties(java.lang.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:
java.lang.NullPointerException- if any argument isnull.
-
removeFeatureProperties
ThingBuilder.FromScratch removeFeatureProperties(java.lang.String featureId)
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:
java.lang.NullPointerException- iffeatureIdisnull.
-
setFeatureDesiredProperty
ThingBuilder.FromScratch setFeatureDesiredProperty(java.lang.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:
java.lang.NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
removeFeatureDesiredProperty
ThingBuilder.FromScratch removeFeatureDesiredProperty(java.lang.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:
java.lang.NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
setFeatureDesiredProperties
ThingBuilder.FromScratch setFeatureDesiredProperties(java.lang.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:
java.lang.NullPointerException- if any argument isnull.- Since:
- 1.5.0
-
removeFeatureDesiredProperties
ThingBuilder.FromScratch removeFeatureDesiredProperties(java.lang.CharSequence featureId)
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:
java.lang.NullPointerException- iffeatureIdisnull.- Since:
- 1.5.0
-
setFeatures
ThingBuilder.FromScratch setFeatures(org.eclipse.ditto.json.JsonObject featuresJsonObject)
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:
java.lang.NullPointerException- iffeaturesJsonObjectisnull.org.eclipse.ditto.base.model.exceptions.DittoJsonException- iffeaturesJsonObjectcannot be parsed toFeatures.
-
setFeatures
ThingBuilder.FromScratch setFeatures(java.lang.String featuresJsonString)
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:
org.eclipse.ditto.base.model.exceptions.DittoJsonException- iffeaturesJsonStringcannot be parsed toFeatures.
-
setFeatures
ThingBuilder.FromScratch setFeatures(java.lang.Iterable<Feature> features)
Sets the given Features to this builder.- Parameters:
features- the Features to be set.- Returns:
- this builder to allow method chaining.
- Throws:
java.lang.NullPointerException- iffeaturesisnull.
-
removeAllFeatures
ThingBuilder.FromScratch removeAllFeatures()
Removes all features from this builder.- Returns:
- this builder to allow method chaining.
-
setEmptyFeatures
ThingBuilder.FromScratch setEmptyFeatures()
Sets empty features to this builder. All already set features are discarded.- Returns:
- this builder to allow method chaining.
-
setNullFeatures
ThingBuilder.FromScratch setNullFeatures()
Sets features to this builder which represents semanticallynull. All already set features are discarded.- Returns:
- this builder to allow method chaining.
-
setLifecycle
ThingBuilder.FromScratch setLifecycle(ThingLifecycle lifecycle)
Sets the given lifecycle to this builder.- Parameters:
lifecycle- the lifecycle to be set.- Returns:
- this builder to allow method chaining.
-
setRevision
ThingBuilder.FromScratch setRevision(ThingRevision revision)
Sets the given revision to this builder.- Parameters:
revision- the revision to be set.- Returns:
- this builder to allow method chaining.
-
setRevision
ThingBuilder.FromScratch setRevision(long revisionNumber)
Sets the given revision number to this builder.- Parameters:
revisionNumber- the revision number to be set.- Returns:
- this builder to allow method chaining.
-
setModified
ThingBuilder.FromScratch setModified(@Nullable java.time.Instant modified)
Sets the given modified timestamp to this builder.- Parameters:
modified- the modified timestamp to be set.- Returns:
- this builder to allow method chaining.
-
setCreated
ThingBuilder.FromScratch setCreated(@Nullable java.time.Instant created)
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
-
setMetadata
ThingBuilder.FromScratch 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
-
setId
ThingBuilder.FromScratch setId(@Nullable ThingId thingId)
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.
-
setGeneratedId
ThingBuilder.FromScratch setGeneratedId()
Sets a generated Thing ID to this builder.- Returns:
- this builder to allow method chaining.
-
-