Interface Resources

  • All Superinterfaces:
    Iterable<Resource>, 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>

    public interface Resources
    extends Iterable<Resource>, org.eclipse.ditto.model.base.json.Jsonifiable.WithFieldSelectorAndPredicate<org.eclipse.ditto.json.JsonField>
    A collection of Resources contained in a single PolicyEntry.
    • 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
      default Optional<Resource> getResource​(String resourceType, CharSequence resourcePath)
      Returns the Resource with the given resourceType and resourcePath or an empty optional.
      Optional<Resource> getResource​(ResourceKey resourceKey)
      Returns the Resource with the given resourcePath or an empty optional.
      int getSize()
      Returns the size of this Resources, i.
      default org.eclipse.ditto.model.base.json.JsonSchemaVersion[] getSupportedSchemaVersions()
      Returns the supported JSON schema version of this resources.
      boolean isEmpty()
      Indicates whether this Resources is empty.
      static Resources newInstance​(Iterable<Resource> resources)
      Returns a new Resources containing the given resources.
      static Resources newInstance​(Resource resource, Resource... furtherResources)
      Returns a new Resources containing the given resource.
      default Resources removeResource​(String resourceType, CharSequence resourcePath)
      Removes the Resource with the given resourceType and resourcePath from a copy of this Resources.
      Resources removeResource​(ResourceKey resourceKey)
      Removes the Resource with the given resourcePath from a copy of this Resources.
      Resources setResource​(Resource resource)
      Sets the given Resource to a copy of this Resources.
      Stream<Resource> stream()
      Returns a sequential Stream with the values of this Resources as its source.
      default org.eclipse.ditto.json.JsonObject toJson()
      Returns all non hidden marked fields of this Resources.
      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, 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

      • newInstance

        static Resources newInstance​(Iterable<Resource> resources)
        Returns a new Resources containing the given resources.
        Parameters:
        resources - the Resources to be contained in the new Resources.
        Returns:
        the new Resources.
        Throws:
        NullPointerException - if resources is null.
      • newInstance

        static Resources newInstance​(Resource resource,
                                     Resource... furtherResources)
        Returns a new Resources containing the given resource.
        Parameters:
        resource - the Resource to be contained in the new Resources.
        furtherResources - further Resources to be contained in the new Resources.
        Returns:
        the new Resources.
        Throws:
        NullPointerException - if any argument is null.
      • getSupportedSchemaVersions

        default org.eclipse.ditto.model.base.json.JsonSchemaVersion[] getSupportedSchemaVersions()
        Returns the supported JSON schema version of this resources. Resources support only JsonSchemaVersion.V_2.
        Specified by:
        getSupportedSchemaVersions in interface org.eclipse.ditto.model.base.json.Jsonifiable<org.eclipse.ditto.json.JsonObject>
        Returns:
        the supported schema version.
      • getResource

        default Optional<Resource> getResource​(String resourceType,
                                               CharSequence resourcePath)
        Returns the Resource with the given resourceType and resourcePath or an empty optional.
        Parameters:
        resourceType - the type of the Resource to be retrieved.
        resourcePath - the path of the Resource to be retrieved.
        Returns:
        the Resource or an empty optional.
        Throws:
        NullPointerException - if resourcePath is null.
        IllegalArgumentException - if resourceType is empty.
      • getResource

        Optional<Resource> getResource​(ResourceKey resourceKey)
        Returns the Resource with the given resourcePath or an empty optional.
        Parameters:
        resourceKey - the ResourceKey of the Resource to be retrieved.
        Returns:
        the Resource with the given path or an empty optional.
        Throws:
        NullPointerException - if path is null.
      • setResource

        Resources setResource​(Resource resource)
        Sets the given Resource to a copy of this Resources. A previous Resource with the same identifier will be overwritten.
        Parameters:
        resource - the Resource to be set.
        Returns:
        a copy of this Resources with resource set.
        Throws:
        NullPointerException - if resource is null.
      • removeResource

        default Resources removeResource​(String resourceType,
                                         CharSequence resourcePath)
        Removes the Resource with the given resourceType and resourcePath from a copy of this Resources.
        Parameters:
        resourceType - the type of the Resource to be removed.
        resourcePath - the path of the Resource to be removed.
        Returns:
        a copy of this Resources with resource removed.
        Throws:
        NullPointerException - if any argument is null.
        IllegalArgumentException - if resourceType is empty.
      • removeResource

        Resources removeResource​(ResourceKey resourceKey)
        Removes the Resource with the given resourcePath from a copy of this Resources.
        Parameters:
        resourceKey - the ResourceKey of the Resource to be removed.
        Returns:
        a copy of this Resources with resource removed.
        Throws:
        NullPointerException - if resourceKey is null.
      • getSize

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

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

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

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