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 Detail

      • setPolicyId

        ThingBuilder.FromCopy 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.FromCopy removePolicyId()
        Removes the Policy ID from this builder.
        Returns:
        this builder to allow method chaining.
      • setAttributes

        default ThingBuilder.FromCopy 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 - if attributes is null.
      • setAttributes

        ThingBuilder.FromCopy setAttributes​(java.util.function.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:
        java.lang.NullPointerException - if any argument is null.
      • setAttributes

        default ThingBuilder.FromCopy setAttributes​(org.eclipse.ditto.json.JsonObject attributesJsonObject)
        Sets the attributes to this builder. The attributes are parsed from the given JSON object representation of Attributes.
        Parameters:
        attributesJsonObject - the JSON object representation of the attributes to be set.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if attributesJsonObject is null.
      • setAttributes

        ThingBuilder.FromCopy setAttributes​(java.util.function.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 of Attributes.
        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:
        java.lang.NullPointerException - if any argument is null.
      • setAttributes

        default ThingBuilder.FromCopy setAttributes​(java.lang.String attributesJsonString)
        Sets the attributes to this builder. The attributes are parsed from the given JSON string representation of Attributes.
        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 - if attributesJsonString is not a valid JSON object.
      • setAttributes

        ThingBuilder.FromCopy setAttributes​(java.util.function.Predicate<Attributes> existingAttributesPredicate,
                                            java.lang.String attributesJsonString)
        Sets the attributes to this builder. The attributes are parsed from the given JSON string representation of Attributes.
        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:
        java.lang.NullPointerException - if existingAttributesPredicate is null.
        org.eclipse.ditto.base.model.exceptions.DittoJsonException - if attributesJsonString is not a valid JSON object.
      • removeAllAttributes

        default ThingBuilder.FromCopy removeAllAttributes()
        Removes all attributes from this builder.
        Returns:
        this builder to allow method chaining.
      • removeAllAttributes

        ThingBuilder.FromCopy removeAllAttributes​(java.util.function.Predicate<Attributes> existingAttributesPredicate)
        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:
        java.lang.NullPointerException - if existingAttributesPredicate is null.
      • setNullAttributes

        ThingBuilder.FromCopy setNullAttributes()
        Sets attributes to this builder which represent semantically null. 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:
        java.lang.NullPointerException - if any argument is null.
        java.lang.IllegalArgumentException - if attributePath is empty.
      • setAttribute

        ThingBuilder.FromCopy setAttribute​(java.util.function.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:
        java.lang.NullPointerException - if any argument is null.
        java.lang.IllegalArgumentException - if attributePath is empty.
      • removeAttribute

        default ThingBuilder.FromCopy 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 attributePath is null.
      • removeAttribute

        ThingBuilder.FromCopy removeAttribute​(java.util.function.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:
        java.lang.NullPointerException - if any argument is null.
      • setDefinition

        ThingBuilder.FromCopy setDefinition​(@Nullable
                                            ThingDefinition definition)
        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 semantically null. 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

        default ThingBuilder.FromCopy 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 - if feature is null.
      • setFeature

        ThingBuilder.FromCopy setFeature​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                         Feature feature)
        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:
        java.lang.NullPointerException - if any argument is null.
      • setFeature

        default ThingBuilder.FromCopy 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 ID of the Feature to be set.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if featureId is null.
      • setFeature

        ThingBuilder.FromCopy setFeature​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                         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:
        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:
        java.lang.NullPointerException - if any argument is null.
      • removeFeature

        default ThingBuilder.FromCopy removeFeature​(java.lang.String featureId)
        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:
        java.lang.NullPointerException - if featureId is null.
      • removeFeature

        ThingBuilder.FromCopy removeFeature​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                            java.lang.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:
        java.lang.NullPointerException - if any argument is null.
      • setFeature

        default ThingBuilder.FromCopy 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 - if featureId is null.
      • setFeature

        ThingBuilder.FromCopy setFeature​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                         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:
        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:
        java.lang.NullPointerException - if any argument is null.
      • setFeature

        default ThingBuilder.FromCopy 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 - if featureId is null.
      • setFeature

        default ThingBuilder.FromCopy setFeature​(java.lang.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:
        java.lang.NullPointerException - if featureId is null.
        Since:
        1.5.0
      • setFeature

        ThingBuilder.FromCopy setFeature​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                         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:
        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:
        java.lang.NullPointerException - if any argument is null.
      • setFeature

        ThingBuilder.FromCopy setFeature​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                         java.lang.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:
        java.lang.NullPointerException - if any argument is null.
        Since:
        1.5.0
      • setFeatureDefinition

        default ThingBuilder.FromCopy setFeatureDefinition​(java.lang.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:
        java.lang.NullPointerException - if any argument is null.
      • setFeatureDefinition

        ThingBuilder.FromCopy setFeatureDefinition​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                                   java.lang.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:
        java.lang.NullPointerException - if any argument is null.
      • removeFeatureDefinition

        ThingBuilder.FromCopy 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 - if featureId is null.
      • setFeatureProperty

        default ThingBuilder.FromCopy 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 is null.
      • setFeatureProperty

        ThingBuilder.FromCopy setFeatureProperty​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                                 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:
        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:
        java.lang.NullPointerException - if any argument is null.
      • removeFeatureProperty

        default ThingBuilder.FromCopy 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 is null.
      • removeFeatureProperty

        ThingBuilder.FromCopy removeFeatureProperty​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                                    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:
        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:
        java.lang.NullPointerException - if any argument is null.
      • setFeatureProperties

        default ThingBuilder.FromCopy 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 is null.
      • setFeatureProperties

        ThingBuilder.FromCopy setFeatureProperties​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                                   java.lang.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:
        java.lang.NullPointerException - if any argument is null.
      • removeFeatureProperties

        default ThingBuilder.FromCopy 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 - if featureId is null.
      • removeFeatureProperties

        ThingBuilder.FromCopy removeFeatureProperties​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                                      java.lang.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:
        java.lang.NullPointerException - if any argument is null.
      • setFeatureDesiredProperty

        default ThingBuilder.FromCopy 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 is null.
        Since:
        1.5.0
      • setFeatureDesiredProperty

        ThingBuilder.FromCopy setFeatureDesiredProperty​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                                        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:
        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:
        java.lang.NullPointerException - if any argument is null.
        Since:
        1.5.0
      • removeFeatureDesiredProperty

        default ThingBuilder.FromCopy 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 is null.
        Since:
        1.5.0
      • removeFeatureDesiredProperty

        ThingBuilder.FromCopy removeFeatureDesiredProperty​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                                           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:
        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:
        java.lang.NullPointerException - if any argument is null.
        Since:
        1.5.0
      • setFeatureDesiredProperties

        default ThingBuilder.FromCopy 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 is null.
        Since:
        1.5.0
      • setFeatureDesiredProperties

        ThingBuilder.FromCopy setFeatureDesiredProperties​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                                          java.lang.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:
        java.lang.NullPointerException - if any argument is null.
        Since:
        1.5.0
      • removeFeatureDesiredProperties

        default ThingBuilder.FromCopy 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 - if featureId is null.
        Since:
        1.5.0
      • removeFeatureDesiredProperties

        ThingBuilder.FromCopy removeFeatureDesiredProperties​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                                             java.lang.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:
        java.lang.NullPointerException - if any argument is null.
        Since:
        1.5.0
      • setFeatures

        default ThingBuilder.FromCopy setFeatures​(org.eclipse.ditto.json.JsonObject featuresJsonObject)
        Sets the features to this builder. The features are parsed from the given JSON object representation of Features.
        Parameters:
        featuresJsonObject - JSON object representation of the features to be set.
        Returns:
        this builder to allow method chaining.
        Throws:
        java.lang.NullPointerException - if featuresJsonObject is null.
        org.eclipse.ditto.base.model.exceptions.DittoJsonException - if featuresJsonObject cannot be parsed to Features.
      • setFeatures

        ThingBuilder.FromCopy setFeatures​(java.util.function.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 of Features.
        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:
        java.lang.NullPointerException - if any argument is null.
        org.eclipse.ditto.base.model.exceptions.DittoJsonException - if featuresJsonObject cannot be parsed to Features.
      • setFeatures

        default ThingBuilder.FromCopy 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:
        java.lang.NullPointerException - if featuresJsonString is null.
        org.eclipse.ditto.base.model.exceptions.DittoJsonException - if featuresJsonString cannot be parsed to Features.
      • setFeatures

        ThingBuilder.FromCopy setFeatures​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                          java.lang.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:
        java.lang.NullPointerException - if any argument is null.
        org.eclipse.ditto.base.model.exceptions.DittoJsonException - if featuresJsonString cannot be parsed to Features.
      • setFeatures

        default ThingBuilder.FromCopy 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 - if features is null.
      • setFeatures

        ThingBuilder.FromCopy setFeatures​(java.util.function.Predicate<Features> existingFeaturesPredicate,
                                          java.lang.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:
        java.lang.NullPointerException - if any argument is null.
      • removeAllFeatures

        default ThingBuilder.FromCopy removeAllFeatures()
        Removes all features from this builder.
        Returns:
        this builder to allow method chaining.
      • removeAllFeatures

        ThingBuilder.FromCopy removeAllFeatures​(java.util.function.Predicate<Features> existingFeaturesPredicate)
        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:
        java.lang.NullPointerException - if existingFeaturesPredicate is null.
      • setNullFeatures

        ThingBuilder.FromCopy setNullFeatures()
        Sets features to this builder which represents semantically null. All already set features are discarded.
        Returns:
        this builder to allow method chaining.
      • setLifecycle

        default ThingBuilder.FromCopy setLifecycle​(@Nullable
                                                   ThingLifecycle lifecycle)
        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​(java.util.function.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:
        java.lang.NullPointerException - if existingLifecyclePredicate is null.
      • setRevision

        default ThingBuilder.FromCopy 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.FromCopy setRevision​(java.util.function.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:
        java.lang.NullPointerException - if existingRevisionPredicate is null.
      • setRevision

        default ThingBuilder.FromCopy 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.
      • setRevision

        ThingBuilder.FromCopy setRevision​(java.util.function.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:
        java.lang.NullPointerException - if existingRevisionPredicate is null.
      • setModified

        default ThingBuilder.FromCopy setModified​(@Nullable
                                                  java.time.Instant modified)
        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​(java.util.function.Predicate<java.time.Instant> existingModifiedPredicate,
                                          @Nullable
                                          java.time.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:
        java.lang.NullPointerException - if existingModifiedPredicate is null.
      • setCreated

        default ThingBuilder.FromCopy 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
      • setCreated

        ThingBuilder.FromCopy setCreated​(java.util.function.Predicate<java.time.Instant> existingCreatedPredicate,
                                         @Nullable
                                         java.time.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:
        java.lang.NullPointerException - if existingCreatedPredicate is null.
        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​(java.util.function.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

        default ThingBuilder.FromCopy 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.
        Throws:
        ThingIdInvalidException - if thingId does not comply to the required pattern.
      • setId

        ThingBuilder.FromCopy setId​(java.util.function.Predicate<ThingId> existingIdPredicate,
                                    @Nullable
                                    ThingId thingId)
        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:
        java.lang.NullPointerException - if existingIdPredicate is null.
        ThingIdInvalidException - if thingId does not comply to the required pattern.
      • setGeneratedId

        default ThingBuilder.FromCopy setGeneratedId()
        Sets a generated Thing ID to this builder.
        Returns:
        this builder to allow method chaining.
      • setGeneratedId

        ThingBuilder.FromCopy setGeneratedId​(java.util.function.Predicate<ThingId> existingIdPredicate)
        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:
        java.lang.NullPointerException - if existingIdPredicate is null.
      • build

        Thing build()
        Creates a new Thing object based on the data which was provided to this builder.
        Returns:
        a new Thing object.