Class ThingsModelFactory


  • @Immutable
    public final class ThingsModelFactory
    extends Object
    Factory that creates new things objects.
    • Method Detail

      • emptyAttributes

        public static Attributes emptyAttributes()
        Returns a new immutable empty Attributes.
        Returns:
        the new immutable empty Attributes.
      • nullAttributes

        public static Attributes nullAttributes()
        Returns a new immutable Attributes which represents null.
        Returns:
        the new null-like Attributes.
      • newAttributes

        public static Attributes newAttributes​(org.eclipse.ditto.json.JsonObject jsonObject)
        Returns a new immutable Attributes which is initialised with the values of the given JSON object.
        Parameters:
        jsonObject - provides the initial values of the result.
        Returns:
        the new immutable initialised Attributes.
        Throws:
        NullPointerException - if jsonObject is null.
      • newAttributes

        public static Attributes newAttributes​(String jsonString)
        Returns a new immutable Attributes which is initialised with the values of the given JSON string. This string is required to be a valid JsonObject.
        Parameters:
        jsonString - provides the initial values of the result;
        Returns:
        the new immutable initialised Attributes.
        Throws:
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonString cannot be parsed to Attributes.
      • newAttributesBuilder

        public static AttributesBuilder newAttributesBuilder()
        Returns a new empty builder for a Attributes.
        Returns:
        the builder.
      • newAttributesBuilder

        public static AttributesBuilder newAttributesBuilder​(org.eclipse.ditto.json.JsonObject jsonObject)
        Returns a new builder for a Attributes which is initialised with the values of the given JSON object.
        Parameters:
        jsonObject - provides the initial values of the result.
        Returns:
        the builder.
        Throws:
        NullPointerException - if jsonObject is null.
      • newDefinition

        public static ThingDefinition newDefinition​(@Nullable
                                                    CharSequence thingDefinition)
        Returns a new immutable ThingDefinition which is initialised with the parsed thingDefinition.
        Parameters:
        thingDefinition - Definition identifier which should be parsed as ThingDefinition.
        Returns:
        new ThingDefinition with the parsed definition identifier.
      • nullDefinition

        public static ThingDefinition nullDefinition()
        Returns a new immutable ThingDefinition which represents null.
        Returns:
        the new null-like ThingDefinition.
      • newFeatureDefinition

        public static FeatureDefinition newFeatureDefinition​(org.eclipse.ditto.json.JsonArray jsonArray)
        Parses the specified JsonArray and returns an immutable instance of FeatureDefinition which is initialised with the values of the given JSON array.
        Parameters:
        jsonArray - JSON array containing the identifiers of the FeatureDefinition to be returned. Non-string values are ignored.
        Returns:
        the instance.
        Throws:
        NullPointerException - if jsonArray is null.
        FeatureDefinitionEmptyException - if jsonArray is empty.
        DefinitionIdentifierInvalidException - if any Identifier string of the array is invalid.
      • newFeatureDefinition

        public static FeatureDefinition newFeatureDefinition​(String jsonString)
        Returns a new immutable FeatureDefinition which is initialised with the values of the given JSON string. This string is required to be a valid JsonArray.
        Parameters:
        jsonString - provides the initial values of the result;
        Returns:
        the new immutable initialised FeatureDefinition.
        Throws:
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonString cannot be parsed to FeatureDefinition.
        FeatureDefinitionEmptyException - if the JSON array is empty.
        DefinitionIdentifierInvalidException - if any Identifier of the JSON array is invalid.
      • nullFeatureDefinition

        public static FeatureDefinition nullFeatureDefinition()
        Returns a new immutable FeatureDefinition which represents null.
        Returns:
        the new null-like FeatureDefinition.
      • newFeatureDefinitionBuilder

        public static FeatureDefinitionBuilder newFeatureDefinitionBuilder​(CharSequence firstIdentifier)
        Parses the specified CharSequence and returns a mutable builder with a fluent API for an immutable FeatureDefinition. The returned builder is initialised with the parsed Identifier as its first one.
        Parameters:
        firstIdentifier - CharSequence-representation of the first FeatureDefinition Identifier.
        Returns:
        the instance.
        Throws:
        NullPointerException - if firstIdentifier is null.
        DefinitionIdentifierInvalidException - if firstIdentifier is invalid.
      • newFeatureDefinitionBuilder

        public static FeatureDefinitionBuilder newFeatureDefinitionBuilder​(org.eclipse.ditto.json.JsonArray jsonArray)
        Returns a new builder for an immutable FeatureDefinition which is initialised with the values of the given JSON array.
        Parameters:
        jsonArray - provides the initial values of the result.
        Returns:
        the builder.
        Throws:
        NullPointerException - if jsonArray is null.
        DefinitionIdentifierInvalidException - if any Identifier of the array is invalid.
      • emptyFeatureProperties

        public static FeatureProperties emptyFeatureProperties()
        Returns a new immutable empty FeatureProperties.
        Returns:
        the new immutable empty FeatureProperties.
      • nullFeatureProperties

        public static FeatureProperties nullFeatureProperties()
        Returns a new immutable FeatureProperties which represents null.
        Returns:
        the new null-like FeatureProperties.
      • newFeatureProperties

        public static FeatureProperties newFeatureProperties​(org.eclipse.ditto.json.JsonObject jsonObject)
        Returns a new immutable FeatureProperties which is initialised with the values of the given JSON object.
        Parameters:
        jsonObject - provides the initial values of the result.
        Returns:
        the new immutable initialised FeatureProperties.
        Throws:
        NullPointerException - if jsonObject is null.
      • newFeatureProperties

        public static FeatureProperties newFeatureProperties​(String jsonString)
        Returns a new immutable FeatureProperties which is initialised with the values of the given JSON string. This string is required to be a valid JsonObject.
        Parameters:
        jsonString - provides the initial values of the result;
        Returns:
        the new immutable initialised FeatureProperties.
        Throws:
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonString cannot be parsed to FeatureProperties.
      • newFeaturePropertiesBuilder

        public static FeaturePropertiesBuilder newFeaturePropertiesBuilder​(org.eclipse.ditto.json.JsonObject jsonObject)
        Returns a new builder for an immutable FeatureProperties which is initialised with the values of the given JSON object.
        Parameters:
        jsonObject - provides the initial values of the result.
        Returns:
        the builder.
        Throws:
        NullPointerException - if jsonObject is null.
      • nullFeature

        public static Feature nullFeature​(String featureId)
        Returns a new immutable Feature which represents null.
        Parameters:
        featureId - the ID of the new Feature.
        Returns:
        the new null-like Feature.
        Throws:
        NullPointerException - if featureId is null.
      • newFeature

        public static Feature newFeature​(String featureId)
        Returns a new immutable Feature with the given ID.
        Parameters:
        featureId - the ID of the new Feature.
        Returns:
        the new immutable Feature.
        Throws:
        NullPointerException - if featureId is null.
      • newFeature

        public static Feature newFeature​(String featureId,
                                         @Nullable
                                         FeatureProperties featureProperties)
        Returns a new immutable Feature with the given ID and properties.
        Parameters:
        featureId - the ID of the new feature.
        featureProperties - the properties of the new Feature or null.
        Returns:
        the new immutable Feature.
        Throws:
        NullPointerException - if featureId is null.
      • newFeature

        public static Feature newFeature​(String featureId,
                                         @Nullable
                                         FeatureDefinition featureDefinition)
        Returns a new immutable Feature with the given ID, properties and Definition.
        Parameters:
        featureId - the ID of the new feature.
        featureDefinition - the Definition of the new Feature or null.
        Returns:
        the new immutable Feature.
        Throws:
        NullPointerException - if featureId is null.
      • newFeature

        public static Feature newFeature​(String featureId,
                                         @Nullable
                                         FeatureDefinition featureDefinition,
                                         @Nullable
                                         FeatureProperties featureProperties)
        Returns a new immutable Feature with the given ID, properties and Definition.
        Parameters:
        featureId - the ID of the new feature.
        featureDefinition - the Definition of the new Feature or null.
        featureProperties - the properties of the new Feature or null.
        Returns:
        the new immutable Feature.
        Throws:
        NullPointerException - if featureId is null.
      • newFeatureBuilder

        public static FeatureBuilder.FromCopyBuildable newFeatureBuilder​(Feature feature)
        Returns a new builder for an immutable Feature which is initialised with the values of the given Feature.
        Parameters:
        feature - provides the initial values for the result.
        Returns:
        the builder.
        Throws:
        NullPointerException - if feature is null.
      • newFeatureBuilder

        public static FeatureBuilder.FromJsonBuildable newFeatureBuilder​(org.eclipse.ditto.json.JsonObject jsonObject)
        Returns a new builder for an immutable Feature which is initialised with the values of the given JSON object.
        Parameters:
        jsonObject - provides the initial values for the result.
        Returns:
        the builder.
        Throws:
        NullPointerException - if jsonObject is null.
      • newFeatureBuilder

        public static FeatureBuilder.FromJsonBuildable newFeatureBuilder​(String jsonString)
        Returns a new builder for an immutable Feature which is initialised with the values of the given JSON string. The JSON string is parsed in a fault tolerant way. I. e. all properties which cannot be deserialized are supposed to not exist.
        Parameters:
        jsonString - string the JSON string representation of a Feature.
        Returns:
        the builder.
        Throws:
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonString cannot be parsed to Feature.
        See Also:
        newFeatureBuilder(JsonObject)
      • emptyFeatures

        public static Features emptyFeatures()
        Returns a new immutable empty Features.
        Returns:
        the new immutable empty Features.
      • nullFeatures

        public static Features nullFeatures()
        Returns a new immutable Features which represents null.
        Returns:
        the new null-like Features.
      • newFeatures

        public static Features newFeatures​(Iterable<Feature> features)
        Returns a new immutable Features which is initialised with the features of the given Iterable.
        Parameters:
        features - the features to initialise the result with.
        Returns:
        the new immutable Features which is initialised with features.
        Throws:
        NullPointerException - if features is null.
      • newFeatures

        public static Features newFeatures​(org.eclipse.ditto.json.JsonObject jsonObject)
        Returns a new immutable Features based on the given JSON object.
        Parameters:
        jsonObject - provides the initial values for the result.
        Returns:
        the new immutable Features which is initialised by the data of jsonObject.
        Throws:
        NullPointerException - if jsonObject is null.
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if any JSON field which is supposed to represent a Feature is not a JSON object.
      • newFeatures

        public static Features newFeatures​(String jsonString)
        Returns a new immutable Features based on the given JSON string.
        Parameters:
        jsonString - provides the initial values of the result.
        Returns:
        the new immutable initialised Features.
        Throws:
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonString cannot be parsed to Features.
      • newFeatures

        public static Features newFeatures​(Feature feature,
                                           Feature... additionalFeatures)
        Returns a new immutable Features which is initialised with the given features.
        Parameters:
        feature - the initial Feature of the result.
        additionalFeatures - additional features of the result.
        Returns:
        the new immutable Features which is initialised with feature and potentially with additionalFeatures.
        Throws:
        NullPointerException - if any argument is null.
      • newFeaturesBuilder

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

        public static FeaturesBuilder newFeaturesBuilder​(Iterable<Feature> features)
        Returns a new mutable builder with a fluent API for an immutable Features. The builder is initialised with the given features.
        Parameters:
        features - the initial features of the new builder.
        Returns:
        the builder.
        Throws:
        NullPointerException - if features is null.
      • newThingRevision

        public static ThingRevision newThingRevision​(long revisionNumber)
        Returns a new immutable ThingRevision which is initialised with the given revision number.
        Parameters:
        revisionNumber - the long value of the revision.
        Returns:
        the new immutable ThingRevision.
      • noPermissions

        @Deprecated
        public static Permissions noPermissions()
        Deprecated.
        Permissions belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new empty mutable Permissions.
        Returns:
        the new Permissions.
      • allPermissions

        public static Permissions allPermissions()
        Deprecated.
        Permissions belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new mutable Permissions containing all available permissions.
        Returns:
        the new Permissions.
        See Also:
        Permission.values()
      • newPermissions

        public static Permissions newPermissions​(Collection<Permission> permissions)
        Deprecated.
        Permissions belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new mutable Permissions containing the given permissions.
        Parameters:
        permissions - the permissions to initialise the result with.
        Returns:
        the new Permissions.
        Throws:
        NullPointerException - if permissions is null;
      • newPermissions

        public static Permissions newPermissions​(Permission permission,
                                                 Permission... furtherPermissions)
        Deprecated.
        Permissions belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new mutable Permissions containing the given permissions.
        Parameters:
        permission - the mandatory permission to be contained in the result.
        furtherPermissions - additional permissions to be contained in the result.
        Returns:
        the new Permissions.
        Throws:
        NullPointerException - if any argument is null.
      • newUnmodifiablePermissions

        public static Permissions newUnmodifiablePermissions​(Permission permission,
                                                             Permission... furtherPermissions)
        Deprecated.
        Permissions belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new unmodifiable Permissions containing the given permissions.
        Parameters:
        permission - the mandatory permission to be contained in the result.
        furtherPermissions - additional permissions to be contained in the result.
        Returns:
        the new Permissions.
        Throws:
        NullPointerException - if any argument is null.
      • newAclEntry

        public static AclEntry newAclEntry​(org.eclipse.ditto.model.base.auth.AuthorizationSubject authorizationSubject,
                                           Permission permission,
                                           Permission... furtherPermissions)
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new immutable AclEntry with the given authorization subject and permissions.
        Parameters:
        authorizationSubject - the authorization subject of the new ACL entry.
        permission - the permission of the new ACL entry.
        furtherPermissions - additional permission of the new ACL entry.
        Returns:
        the new ACL entry.
        Throws:
        NullPointerException - if any argument is null.
      • newAclEntry

        public static AclEntry newAclEntry​(org.eclipse.ditto.model.base.auth.AuthorizationSubject authorizationSubject,
                                           Iterable<Permission> permissions)
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new immutable AclEntry with the given authorization subject and permissions.
        Parameters:
        authorizationSubject - the authorization subject of the new ACL entry.
        permissions - the permissions of the new ACL entry.
        Returns:
        the new ACL entry.
        Throws:
        NullPointerException - if any argument is null.
      • newAclEntry

        public static AclEntry newAclEntry​(org.eclipse.ditto.json.JsonObject jsonObject)
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new immutable AclEntry based on the given JSON object.
        Parameters:
        jsonObject - provides the initial values for the result.
        Returns:
        the new ACL entry.
        Throws:
        NullPointerException - if jsonObject is null.
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonObject cannot be parsed.
      • newAclEntry

        @Deprecated
        public static AclEntry newAclEntry​(CharSequence authorizationSubjectId,
                                           org.eclipse.ditto.json.JsonValue permissionsValue)
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new immutable AclEntry with the given authorization subject ID and the given JSON value which provides the permissions.
        Parameters:
        authorizationSubjectId - the ID of the authorization subject of the new ACL entry.
        permissionsValue - a JSON value which represents the permissions of the authorization subject of the new ACL entry. This value is supposed to be a JSON object.
        Returns:
        the new ACL entry.
        Throws:
        NullPointerException - if any argument is null.
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if permissionsValue is not a JSON object.
        AclEntryInvalidException - if permissionsValue does not contain a boolean value for the required permissions.
      • newAclBuilder

        @Deprecated
        public static AccessControlListBuilder newAclBuilder()
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a mutable builder with a fluent API for an immutable AccessControlList.
        Returns:
        the new builder.
      • newAclBuilder

        @Deprecated
        public static AccessControlListBuilder newAclBuilder​(Iterable<AclEntry> aclEntries)
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a mutable builder with a fluent API for an immutable AccessControlList. The builder is initialised with the given ACL entries.
        Parameters:
        aclEntries - the initial entries of the new builder.
        Returns:
        the new builder.
        Throws:
        NullPointerException - if aclEntries is null.
      • newAclBuilder

        @Deprecated
        public static AccessControlListBuilder newAclBuilder​(Optional<? extends Iterable<AclEntry>> aclEntries)
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a mutable builder with a fluent API for an immutable AccessControlList. The builder is initialised with the given ACL entries.
        Parameters:
        aclEntries - the initial entries of the new builder.
        Returns:
        the new builder.
        Throws:
        NullPointerException - if aclEntries is null.
      • emptyAcl

        @Deprecated
        public static AccessControlList emptyAcl()
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new empty immutable AccessControlList.
        Returns:
        the new ACL.
      • newAcl

        @Deprecated
        public static AccessControlList newAcl​(AclEntry entry,
                                               AclEntry... furtherEntries)
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new immutable Access Control List (ACL) which is initialised with the specified entries.
        Parameters:
        entry - the mandatory entry of the ACL.
        furtherEntries - additional entries of the ACL.
        Returns:
        the new initialised Access Control List.
        Throws:
        NullPointerException - if any argument is null.
      • newAcl

        @Deprecated
        public static AccessControlList newAcl​(Iterable<AclEntry> entries)
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new immutable Access Control List (ACL) which is initialised with the specified entries.
        Parameters:
        entries - the entries of the ACL.
        Returns:
        the new initialised Access Control List.
        Throws:
        NullPointerException - if any argument is null.
      • newAcl

        @Deprecated
        public static AccessControlList newAcl​(org.eclipse.ditto.json.JsonObject jsonObject)
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new immutable Access Control List (ACL) based on the given JSON object.
        Parameters:
        jsonObject - the JSON object representation of an ACL.
        Returns:
        the new initialised AccessControlList.
        Throws:
        NullPointerException - if jsonObject is null.
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonObject cannot be parsed to AccessControlList.
      • newAcl

        @Deprecated
        public static AccessControlList newAcl​(String jsonString)
        Deprecated.
        AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
        Returns a new immutable Access Control List (ACL) based on the given JSON string.
        Parameters:
        jsonString - the JSON object representation of an ACL.
        Returns:
        the new initialised AccessControlList.
        Throws:
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonString cannot be parsed to AccessControlList.
      • newThing

        public static Thing newThing​(org.eclipse.ditto.json.JsonObject jsonObject)
        Returns a new immutable Thing based on the given JSON object.
        Parameters:
        jsonObject - the JSON object representation of a Thing.
        Returns:
        the new Thing.
        Throws:
        NullPointerException - if jsonObject is null.
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonObject cannot be parsed to Thing.
      • newThing

        public static Thing newThing​(String jsonString)
        Returns a new immutable Thing based on the given JSON string.
        Parameters:
        jsonString - the JSON string representation of a Thing.
        Returns:
        the new Thing.
        Throws:
        NullPointerException - if jsonString is null.
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonString cannot be parsed to Thing.
      • newThingBuilder

        public static ThingBuilder.FromScratch newThingBuilder()
        Returns a mutable builder with a fluent API for an immutable Thing from scratch.
        Returns:
        the new builder.
      • newThingBuilder

        public static ThingBuilder.FromCopy newThingBuilder​(org.eclipse.ditto.json.JsonObject jsonObject)
        Returns a mutable builder with a fluent API for an immutable Thing based on the given JSON object. The JSON object is parsed in a fault tolerant way. I. e. all properties which cannot be deserialized are supposed to not exist.
        Parameters:
        jsonObject - the JSON object representation of a Thing.
        Returns:
        the new builder.
        Throws:
        NullPointerException - if jsonObject is null.
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonObject cannot be parsed to Thing.
      • newThingBuilder

        public static ThingBuilder.FromCopy newThingBuilder​(String jsonString)
        Returns a mutable builder with a fluent API for an immutable Thing based on the given JSON string. The JSON string is parsed in a fault tolerant way. I. e. all properties which cannot be deserialized are supposed to not exist.
        Parameters:
        jsonString - string the JSON string representation of a Thing.
        Returns:
        the new builder.
        Throws:
        org.eclipse.ditto.model.base.exceptions.DittoJsonException - if jsonString cannot be parsed to Thing.
        See Also:
        newThingBuilder(JsonObject)
      • newThingBuilder

        public static ThingBuilder.FromCopy newThingBuilder​(Thing thing)
        Returns a mutable builder with a fluent API for an immutable Thing. The builder is initialised with the properties of the given Thing.
        Parameters:
        thing - the Thing which provides the initial properties of the builder.
        Returns:
        the new builder.
        Throws:
        NullPointerException - if thing is null.