Interface Features

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

    @Immutable
    public interface Features
    extends Iterable<Feature>, org.eclipse.ditto.model.base.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.model.base.json.Jsonifiable

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

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      Optional<Feature> getFeature​(String featureId)
      Returns the Feature with the given ID or an empty optional.
      int getSize()
      Returns the size of this Features, i.
      boolean isEmpty()
      Indicates whether this Features is empty.
      default boolean isNull()
      Indicates whether this Features are equivalent to semantic null.
      static FeaturesBuilder newBuilder()
      Returns a new mutable builder with a fluent API for an immutable Features.
      Features removeDefinition​(String featureId)
      Removes the definition from the Feature with the given ID from a copy of this Features.
      Features removeFeature​(String featureId)
      Removes the Feature with the given ID from a copy of this Features.
      Features removeProperties​(String featureId)
      Removes all properties of the Feature with the given ID from a copy of this Features.
      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..
      Features setDefinition​(String featureId, FeatureDefinition definition)
      Sets the given definition for the Feature with the given ID on a copy of this Features.
      Features setFeature​(Feature feature)
      Sets the given Feature to a copy of this Features.
      Features setProperties​(String featureId, FeatureProperties properties)
      Sets the given properties for the Feature with the given ID on a copy of this Features.
      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.
      Stream<Feature> stream()
      Returns a sequential Stream with the values of this Features as its source.
      default FeaturesBuilder toBuilder()
      Returns a new mutable builder with a fluent API for an immutable Features.
      default org.eclipse.ditto.json.JsonObject toJson()
      Returns all non hidden marked fields of this Features.
      default org.eclipse.ditto.json.JsonObject toJson​(org.eclipse.ditto.model.base.json.JsonSchemaVersion schemaVersion, org.eclipse.ditto.json.JsonFieldSelector fieldSelector)  
      • Methods inherited from interface org.eclipse.ditto.model.base.json.Jsonifiable

        getImplementedSchemaVersion, getLatestSchemaVersion, getSupportedSchemaVersions, implementsSchemaVersion, implementsSchemaVersion, toJsonString
      • Methods inherited from interface org.eclipse.ditto.model.base.json.Jsonifiable.WithFieldSelector

        toJson, toJson, toJson, toJsonString, toJsonString
      • Methods inherited from interface org.eclipse.ditto.model.base.json.Jsonifiable.WithFieldSelectorAndPredicate

        toJson, toJson, toJsonString, toJsonString
      • Methods inherited from interface org.eclipse.ditto.model.base.json.Jsonifiable.WithPointer

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

        toJson, toJson, toJsonString, toJsonString
    • Method Detail

      • 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.
      • 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.model.base.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.model.base.json.JsonSchemaVersion schemaVersion,
                                                         org.eclipse.ditto.json.JsonFieldSelector fieldSelector)
        Specified by:
        toJson in interface org.eclipse.ditto.model.base.json.Jsonifiable.WithFieldSelector