Interface Features

All Superinterfaces:
Iterable<Feature>, org.eclipse.ditto.base.model.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>, org.eclipse.ditto.base.model.json.Jsonifiable.WithFieldSelector, org.eclipse.ditto.base.model.json.Jsonifiable.WithFieldSelectorAndPredicate<org.eclipse.ditto.json.JsonField>, org.eclipse.ditto.base.model.json.Jsonifiable.WithPointer<org.eclipse.ditto.json.JsonObject>, org.eclipse.ditto.base.model.json.Jsonifiable.WithPredicate<org.eclipse.ditto.json.JsonObject,org.eclipse.ditto.json.JsonField>

@Immutable public interface Features extends Iterable<Feature>, org.eclipse.ditto.base.model.json.Jsonifiable.WithFieldSelectorAndPredicate<org.eclipse.ditto.json.JsonField>
A collection of a Thing's Features.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable

    org.eclipse.ditto.base.model.json.Jsonifiable.WithFieldSelector, org.eclipse.ditto.base.model.json.Jsonifiable.WithFieldSelectorAndPredicate<T extends Object>, org.eclipse.ditto.base.model.json.Jsonifiable.WithPointer<J extends org.eclipse.ditto.json.JsonValue>, org.eclipse.ditto.base.model.json.Jsonifiable.WithPredicate<J extends org.eclipse.ditto.json.JsonValue,T extends Object>
  • Method Summary

    Modifier and Type
    Method
    Description
    getFeature(String featureId)
    Returns the Feature with the given ID or an empty optional.
    int
    Returns the size of this Features, i.
    boolean
    Indicates whether this Features is empty.
    default boolean
    Indicates whether this Features are equivalent to semantic null.
    Returns a new mutable builder with a fluent API for an immutable Features.
    Removes the definition from the Feature with the given ID from a copy of this Features.
    Removes all desired properties of the Feature with the given ID from a copy of this Features.
    removeDesiredProperty(CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath)
    Removes the desired property which is referred by the given JSON Pointer from the Feature with the given ID on a copy of this Features..
    removeFeature(String featureId)
    Removes the Feature with the given ID from a copy of this Features.
    Removes all properties of the Feature with the given ID from a copy of this Features.
    removeProperty(String featureId, org.eclipse.ditto.json.JsonPointer propertyPath)
    Removes the property which is referred by the given JSON Pointer from the Feature with the given ID on a copy of this Features..
    setDefinition(String featureId, FeatureDefinition definition)
    Sets the given definition for the Feature with the given ID on a copy of this Features.
    setDesiredProperties(CharSequence featureId, FeatureProperties desiredProperties)
    Sets the given desired properties for the Feature with the given ID on a copy of this Features.
    setDesiredProperty(CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath, org.eclipse.ditto.json.JsonValue desiredPropertyValue)
    Sets the value of the desired property which is referred by the given JSON Pointer of the Feature with the given ID on a copy of this Features.
    Sets the given Feature to a copy of this Features.
    setProperties(String featureId, FeatureProperties properties)
    Sets the given properties for the Feature with the given ID on a copy of this Features.
    setProperty(String featureId, org.eclipse.ditto.json.JsonPointer propertyPath, org.eclipse.ditto.json.JsonValue propertyValue)
    Sets the value of the property which is referred by the given JSON Pointer of the Feature with the given ID on a copy of this Features.
    Returns a sequential Stream with the values of this Features as its source.
    Returns a new mutable builder with a fluent API for an immutable Features.
    default org.eclipse.ditto.json.JsonObject
    Returns all non-hidden marked fields of this Features.
    default org.eclipse.ditto.json.JsonObject
    toJson(org.eclipse.ditto.base.model.json.JsonSchemaVersion schemaVersion, org.eclipse.ditto.json.JsonFieldSelector fieldSelector)
     

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator

    Methods inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable

    getImplementedSchemaVersion, getLatestSchemaVersion, getSupportedSchemaVersions, implementsSchemaVersion, implementsSchemaVersion, toJsonString

    Methods inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable.WithFieldSelector

    toJson, toJson, toJson, toJsonString, toJsonString

    Methods inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable.WithFieldSelectorAndPredicate

    toJson, toJson, toJsonString, toJsonString

    Methods inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable.WithPointer

    toJsonString, toJsonString

    Methods inherited from interface org.eclipse.ditto.base.model.json.Jsonifiable.WithPredicate

    toJson, toJson, toJsonString, toJsonString
  • Method Details

    • newBuilder

      static FeaturesBuilder newBuilder()
      Returns a new mutable builder with a fluent API for an immutable Features.
      Returns:
      the builder.
    • toBuilder

      default FeaturesBuilder toBuilder()
      Returns a new mutable builder with a fluent API for an immutable Features. The builder is initialised with the features of this instance.
      Returns:
      the builder.
    • getFeature

      Optional<Feature> getFeature(String featureId)
      Returns the Feature with the given ID or an empty optional.
      Parameters:
      featureId - the ID of the Feature to be retrieved.
      Returns:
      the Feature with the given ID or an empty optional.
      Throws:
      NullPointerException - if featureId is null.
    • setFeature

      Features setFeature(Feature feature)
      Sets the given Feature to a copy of this Features. A previous Feature with the same ID will be overwritten.
      Parameters:
      feature - the Feature to be set.
      Returns:
      a copy of this Features with feature set.
      Throws:
      NullPointerException - if feature is null.
    • removeFeature

      Features removeFeature(String featureId)
      Removes the Feature with the given ID from a copy of this Features.
      Parameters:
      featureId - the ID of the Feature to be removed.
      Returns:
      a copy of this Features with feature removed.
      Throws:
      NullPointerException - if featureId is null.
    • setDefinition

      Features setDefinition(String featureId, FeatureDefinition definition)
      Sets the given definition for the Feature with the given ID on a copy of this Features. The previous definition of a Feature with the same ID is overwritten.
      Parameters:
      featureId - the ID of the Feature for which the definition is set.
      definition - the definition to be set.
      Returns:
      a copy of this Features with the definition set.
      Throws:
      NullPointerException - if any argument is null.
    • removeDefinition

      Features removeDefinition(String featureId)
      Removes the definition from the Feature with the given ID from a copy of this Features.
      Parameters:
      featureId - the ID of the Feature from which the definition is removed.
      Returns:
      a copy of this Features with the definition of the Feature with featureId removed.
      Throws:
      NullPointerException - if featureId is null.
    • setProperties

      Features setProperties(String featureId, FeatureProperties properties)
      Sets the given properties for the Feature with the given ID on a copy of this Features. The previous properties of a Feature with the same ID are overwritten.
      Parameters:
      featureId - the ID of the Feature for which the properties are set.
      properties - the properties to be set.
      Returns:
      a copy of this Features with the property set.
      Throws:
      NullPointerException - if any argument is null.
    • removeProperties

      Features removeProperties(String featureId)
      Removes all properties of the Feature with the given ID from a copy of this Features.
      Parameters:
      featureId - the ID of the Feature from which all properties are removed.
      Returns:
      a copy of this Features with all properties of the Feature with featureId removed.
      Throws:
      NullPointerException - if featureId is null.
    • setProperty

      Features setProperty(String featureId, org.eclipse.ditto.json.JsonPointer propertyPath, org.eclipse.ditto.json.JsonValue propertyValue)
      Sets the value of the property which is referred by the given JSON Pointer of the Feature with the given ID on a copy of this Features. The value of a previous property at the pointed position is overwritten.
      Parameters:
      featureId - the ID of the Feature of which the property is set.
      propertyPath - defines the hierarchical path within the Feature to the property to be set.
      propertyValue - the property value to be set.
      Returns:
      a copy of this Features with the property set.
      Throws:
      NullPointerException - if any argument is null.
    • removeProperty

      Features removeProperty(String featureId, org.eclipse.ditto.json.JsonPointer propertyPath)
      Removes the property which is referred by the given JSON Pointer from the Feature with the given ID on a copy of this Features..
      Parameters:
      featureId - the ID of the Feature from which the property is removed.
      propertyPath - defines the hierarchical path within the Feature to the property to be removed.
      Returns:
      a copy of this Features with the given property removed.
      Throws:
      NullPointerException - if any argument is null.
    • setDesiredProperties

      Features setDesiredProperties(CharSequence featureId, FeatureProperties desiredProperties)
      Sets the given desired properties for the Feature with the given ID on a copy of this Features. The previous desired properties of a Feature with the same ID are overwritten.
      Parameters:
      featureId - the ID of the Feature for which the desired properties are set.
      desiredProperties - the properties to be set.
      Returns:
      a copy of this Features with the desired property set.
      Throws:
      NullPointerException - if any argument is null.
      Since:
      1.5.0
    • removeDesiredProperties

      Features removeDesiredProperties(CharSequence featureId)
      Removes all desired properties of the Feature with the given ID from a copy of this Features.
      Parameters:
      featureId - the ID of the Feature from which all desired properties are removed.
      Returns:
      a copy of this Features with all desired properties of the Feature with featureId removed.
      Throws:
      NullPointerException - if featureId is null.
      Since:
      1.5.0
    • setDesiredProperty

      Features setDesiredProperty(CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath, org.eclipse.ditto.json.JsonValue desiredPropertyValue)
      Sets the value of the desired property which is referred by the given JSON Pointer of the Feature with the given ID on a copy of this Features. The value of a previous desired property at the pointed position is overwritten.
      Parameters:
      featureId - the ID of the Feature of which the desired property is set.
      desiredPropertyPath - defines the hierarchical path within the Feature to the desired property to be set.
      desiredPropertyValue - the desired property value to be set.
      Returns:
      a copy of this Features with the desired property set.
      Throws:
      NullPointerException - if any argument is null.
      Since:
      1.5.0
    • removeDesiredProperty

      Features removeDesiredProperty(CharSequence featureId, org.eclipse.ditto.json.JsonPointer desiredPropertyPath)
      Removes the desired property which is referred by the given JSON Pointer from the Feature with the given ID on a copy of this Features..
      Parameters:
      featureId - the ID of the Feature from which the desired property is removed.
      desiredPropertyPath - defines the hierarchical path within the Feature to the desired property to be removed.
      Returns:
      a copy of this Features with the given desired property removed.
      Throws:
      NullPointerException - if any argument is null.
      Since:
      1.5.0
    • isNull

      default boolean isNull()
      Indicates whether this Features are equivalent to semantic null.
      Returns:
      true if this Features are semantically null, false else.
    • getSize

      int getSize()
      Returns the size of this Features, i. e. the number of contained values.
      Returns:
      the number of Features.
    • isEmpty

      boolean isEmpty()
      Indicates whether this Features is empty.
      Returns:
      true if this Features does not contain any values, false else.
    • stream

      Stream<Feature> stream()
      Returns a sequential Stream with the values of this Features as its source.
      Returns:
      a sequential stream of the Features of this container.
    • toJson

      default org.eclipse.ditto.json.JsonObject toJson()
      Returns all non-hidden marked fields of this Features.
      Specified by:
      toJson in interface org.eclipse.ditto.base.model.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
      Returns:
      a JSON object representation of this Features including only non-hidden marked fields.
    • toJson

      default org.eclipse.ditto.json.JsonObject toJson(org.eclipse.ditto.base.model.json.JsonSchemaVersion schemaVersion, org.eclipse.ditto.json.JsonFieldSelector fieldSelector)
      Specified by:
      toJson in interface org.eclipse.ditto.base.model.json.Jsonifiable.WithFieldSelector