Package org.eclipse.ditto.model.things
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>
-
-
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 semanticnull
.static FeaturesBuilder
newBuilder()
Returns a new mutable builder with a fluent API for an immutableFeatures
.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 sequentialStream
with the values of this Features as its source.default FeaturesBuilder
toBuilder()
Returns a new mutable builder with a fluent API for an immutableFeatures
.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 java.lang.Iterable
forEach, iterator, spliterator
-
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
-
-
-
-
Method Detail
-
newBuilder
static FeaturesBuilder newBuilder()
Returns a new mutable builder with a fluent API for an immutableFeatures
.- Returns:
- the builder.
-
toBuilder
default FeaturesBuilder toBuilder()
Returns a new mutable builder with a fluent API for an immutableFeatures
. 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
- iffeatureId
isnull
.
-
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
- iffeature
isnull
.
-
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
- iffeatureId
isnull
.
-
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 isnull
.
-
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
- iffeatureId
isnull
.
-
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 isnull
.
-
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
- iffeatureId
isnull
.
-
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 isnull
.
-
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 isnull
.
-
isNull
default boolean isNull()
Indicates whether this Features are equivalent to semanticnull
.- Returns:
true
if this Features are semanticallynull
,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 sequentialStream
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 interfaceorg.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 interfaceorg.eclipse.ditto.model.base.json.Jsonifiable.WithFieldSelector
-
-