Interface Feature

  • All Superinterfaces:
    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 Feature
    extends org.eclipse.ditto.model.base.json.Jsonifiable.WithFieldSelectorAndPredicate<org.eclipse.ditto.json.JsonField>

    A Feature is used to manage all data and functionality of a Thing that can be clustered in an outlined technical context.

    For different contexts or aspects of a Thing, different Features can be used which are all belonging to the same Thing and do not exists without this Thing.

    The data related to Features is managed in form of FeatureProperties. These properties can be categorized, e. g. to manage the status, the configuration or any fault information.

    For Ditto to be able to work with models/concepts of a Feature (e. g. syntactically validate properties of Features or provide detailed information about message parameters, etc.) it is possible to attach a FeatureDefinition. The Definition can be compared to interface declarations in programming languages (with the difference that in programming languages the type system is fully known where as in Ditto the semantics of definitions is not fixed but depends on different usage scenarios like for example validation, mapping, ...).

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Feature.JsonFields
      An enumeration of the known JsonFields of a Feature.
      • 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<FeatureDefinition> getDefinition()
      Returns the attached Definition of this Feature.
      String getId()
      Returns the ID of this Feature.
      Optional<FeatureProperties> getProperties()
      Returns the properties of this Feature.
      default Optional<org.eclipse.ditto.json.JsonValue> getProperty​(CharSequence pointer)
      Gets the property value which is referred by the given JSON Pointer.
      Optional<org.eclipse.ditto.json.JsonValue> getProperty​(org.eclipse.ditto.json.JsonPointer pointer)
      Gets the property value which is referred by the given JSON Pointer.
      static FeatureBuilder.FromScratchBuildable newBuilder()
      Returns a new empty builder for an immutable Feature.
      Feature removeDefinition()
      Removes the Definition from a copy of this Feature.
      Feature removeProperties()
      Removes all properties on a copy of this Feature.
      default Feature removeProperty​(CharSequence pointer)
      Removes the property specified by a JSON Pointer from a copy of this Feature.
      Feature removeProperty​(org.eclipse.ditto.json.JsonPointer pointer)
      Removes the property specified by a JSON Pointer from a copy of this Feature.
      Feature setDefinition​(FeatureDefinition featureDefinition)
      Sets the specified Definition to a copy of this Feature.
      Feature setProperties​(FeatureProperties properties)
      Sets the given properties to a copy of this Feature.
      default Feature setProperty​(CharSequence pointer, boolean propertyValue)
      Sets the value of a property which is referred by the given JSON Pointer.
      default Feature setProperty​(CharSequence pointer, double propertyValue)
      Sets the value of a property which is referred by the given JSON Pointer.
      default Feature setProperty​(CharSequence pointer, int propertyValue)
      Sets the value of a property which is referred by the given JSON Pointer.
      default Feature setProperty​(CharSequence pointer, long propertyValue)
      Sets the value of a property which is referred by the given JSON Pointer.
      default Feature setProperty​(CharSequence pointer, String propertyValue)
      Sets the value of a property which is referred by the given JSON Pointer.
      default Feature setProperty​(CharSequence pointer, org.eclipse.ditto.json.JsonValue propertyValue)
      Sets the value of a property which is referred by the given JSON Pointer.
      Feature setProperty​(org.eclipse.ditto.json.JsonPointer pointer, org.eclipse.ditto.json.JsonValue propertyValue)
      Sets the value of a property which is referred by the given JSON Pointer.
      default FeatureBuilder.FromCopyBuildable toBuilder()
      Returns a new builder for an immutable Feature which is initialised with the values of the this Feature object.
      default org.eclipse.ditto.json.JsonObject toJson()
      Returns all non hidden marked fields of this Feature.
      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

      • toBuilder

        default FeatureBuilder.FromCopyBuildable toBuilder()
        Returns a new builder for an immutable Feature which is initialised with the values of the this Feature object.
        Returns:
        the new builder.
      • getId

        String getId()
        Returns the ID of this Feature.
        Returns:
        the ID of this Feature.
      • getDefinition

        Optional<FeatureDefinition> getDefinition()
        Returns the attached Definition of this Feature.
        Returns:
        the Definition or an empty Optional.
      • setDefinition

        Feature setDefinition​(FeatureDefinition featureDefinition)
        Sets the specified Definition to a copy of this Feature.
        Parameters:
        featureDefinition - the Definition to be attached to a copy of this Feature.
        Returns:
        a copy of this Feature with the specified Definition attached or this Feature instance if the specified Definition was already set.
        Throws:
        NullPointerException - if featureDefinition is null.
      • removeDefinition

        Feature removeDefinition()
        Removes the Definition from a copy of this Feature.
        Returns:
        a copy of this Feature without a Definition or this Feature instance if this feature was already without Definition.
      • getProperties

        Optional<FeatureProperties> getProperties()
        Returns the properties of this Feature.
        Returns:
        the properties of this Feature.
      • setProperties

        Feature setProperties​(FeatureProperties properties)
        Sets the given properties to a copy of this Feature. The previous properties of the Feature are overwritten.
        Parameters:
        properties - the properties to be set.
        Returns:
        a copy of this Feature with the given properties.
        Throws:
        NullPointerException - if properties is null.
      • removeProperties

        Feature removeProperties()
        Removes all properties on a copy of this Feature.
        Returns:
        a copy of this Feature with all of its properties removed.
      • getProperty

        default Optional<org.eclipse.ditto.json.JsonValue> getProperty​(CharSequence pointer)
        Gets the property value which is referred by the given JSON Pointer.
        Parameters:
        pointer - defines the hierarchical path to the property value to be returned.
        Returns:
        the value of the property which is referred by pointer.
        Throws:
        NullPointerException - if pointer is null.
      • getProperty

        Optional<org.eclipse.ditto.json.JsonValue> getProperty​(org.eclipse.ditto.json.JsonPointer pointer)
        Gets the property value which is referred by the given JSON Pointer.
        Parameters:
        pointer - defines the hierarchical path to the property value to be returned.
        Returns:
        the value of the property which is referred by pointer.
        Throws:
        NullPointerException - if pointer is null.
      • setProperty

        default Feature setProperty​(CharSequence pointer,
                                    org.eclipse.ditto.json.JsonValue propertyValue)
        Sets the value of a property which is referred by the given JSON Pointer.
        Parameters:
        pointer - defines the hierarchical path to the property value to be set.
        propertyValue - the property value to be set.
        Returns:
        a copy of this Feature with the given property value set.
        Throws:
        NullPointerException - if any argument is null.
      • setProperty

        default Feature setProperty​(CharSequence pointer,
                                    boolean propertyValue)
        Sets the value of a property which is referred by the given JSON Pointer.
        Parameters:
        pointer - defines the hierarchical path to the property value to be set.
        propertyValue - the property value to be set.
        Returns:
        a copy of this Feature with the given property value set.
        Throws:
        NullPointerException - if any argument is null.
      • setProperty

        default Feature setProperty​(CharSequence pointer,
                                    int propertyValue)
        Sets the value of a property which is referred by the given JSON Pointer.
        Parameters:
        pointer - defines the hierarchical path to the property value to be set.
        propertyValue - the property value to be set.
        Returns:
        a copy of this Feature with the given property value set.
        Throws:
        NullPointerException - if any argument is null.
      • setProperty

        default Feature setProperty​(CharSequence pointer,
                                    long propertyValue)
        Sets the value of a property which is referred by the given JSON Pointer.
        Parameters:
        pointer - defines the hierarchical path to the property value to be set.
        propertyValue - the property value to be set.
        Returns:
        a copy of this Feature with the given property value set.
        Throws:
        NullPointerException - if any argument is null.
      • setProperty

        default Feature setProperty​(CharSequence pointer,
                                    double propertyValue)
        Sets the value of a property which is referred by the given JSON Pointer.
        Parameters:
        pointer - defines the hierarchical path to the property value to be set.
        propertyValue - the property value to be set.
        Returns:
        a copy of this Feature with the given property value set.
        Throws:
        NullPointerException - if any argument is null.
      • setProperty

        default Feature setProperty​(CharSequence pointer,
                                    String propertyValue)
        Sets the value of a property which is referred by the given JSON Pointer.
        Parameters:
        pointer - defines the hierarchical path to the property value to be set.
        propertyValue - the property value to be set.
        Returns:
        a copy of this Feature with the given property value set.
        Throws:
        NullPointerException - if any argument is null.
      • setProperty

        Feature setProperty​(org.eclipse.ditto.json.JsonPointer pointer,
                            org.eclipse.ditto.json.JsonValue propertyValue)
        Sets the value of a property which is referred by the given JSON Pointer.
        Parameters:
        pointer - defines the hierarchical path to the property value to be set.
        propertyValue - the property value to be set.
        Returns:
        a copy of this Feature with the given property value set.
        Throws:
        NullPointerException - if any argument is null.
      • removeProperty

        default Feature removeProperty​(CharSequence pointer)
        Removes the property specified by a JSON Pointer from a copy of this Feature.
        Parameters:
        pointer - defines the hierarchical path to the property to be removed.
        Returns:
        a copy of this Feature with the specified property removed.
        Throws:
        NullPointerException - if pointer is null.
      • removeProperty

        Feature removeProperty​(org.eclipse.ditto.json.JsonPointer pointer)
        Removes the property specified by a JSON Pointer from a copy of this Feature.
        Parameters:
        pointer - defines the hierarchical path to the property to be removed.
        Returns:
        a copy of this Feature with the specified property removed.
        Throws:
        NullPointerException - if pointer is null.
      • toJson

        default org.eclipse.ditto.json.JsonObject toJson()
        Returns all non hidden marked fields of this Feature.
        Specified by:
        toJson in interface org.eclipse.ditto.model.base.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
        Returns:
        a JSON object representation of this Feature 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