Package org.openremote.model.attribute
Class Attribute<T>
java.lang.Object
org.openremote.model.value.AbstractNameValueHolder<T>
org.openremote.model.attribute.Attribute<T>
- All Implemented Interfaces:
Serializable
,MetaHolder
,NameHolder
,NameValueHolder<T>
,ValueHolder<T>
Stores a named value with associated
MetaItem
s.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Custom deserializer that can use asset type info from deserialization context when it is passed in from the asset deserializerstatic class
Custom serializer that can serialize valueStr (for attributes that haven't been fully hydrated)Nested classes/interfaces inherited from interface org.openremote.model.value.NameHolder
NameHolder.NameHolderToStringConverter
-
Field Summary
FieldsFields inherited from class org.openremote.model.value.AbstractNameValueHolder
name, type, value, valueStr
-
Constructor Summary
ConstructorsConstructorDescriptionAttribute
(String name, ValueDescriptor<?> valueDescriptor) Attribute
(String name, ValueDescriptor<T> valueDescriptor, T value) Attribute
(String name, ValueDescriptor<T> valueDescriptor, T value, long timestamp) Attribute
(AttributeDescriptor<T> attributeDescriptor) Attribute
(AttributeDescriptor<T> attributeDescriptor, T value) Attribute
(AttributeDescriptor<T> attributeDescriptor, T value, long timestamp) -
Method Summary
Modifier and TypeMethodDescriptionaddMeta
(@NotNull Collection<MetaItem<?>> meta) addOrReplaceMeta
(@NotNull Collection<MetaItem<?>> meta) addOrReplaceMeta
(@NotNull MetaItem<?>... meta) addOrReplaceMeta
(@NotNull MetaMap meta) boolean
deepEquals
(Object o) boolean
Super fast equality checking using the name, type and timestamp; when anAttribute
value is updated then the timestamp must be greater than the existing value timestamp; and also when merging anAsset
any modifiedAttribute
should have a newer timestamp; the backend should take care to update theAttribute
timestamp when merging anAsset
by usingdeepEquals(java.lang.Object)
.boolean
equals
(Object obj, Comparator<Attribute<?>> comparator) getAddedOrModifiedAttributes
(Collection<Attribute<?>> oldAttributes, Collection<Attribute<?>> newAttributes) getAddedOrModifiedAttributes
(Collection<Attribute<?>> oldAttributes, Collection<Attribute<?>> newAttributes, Predicate<String> ignoredAttributeNames) getAddedOrModifiedAttributes
(Collection<Attribute<?>> oldAttributes, Collection<Attribute<?>> newAttributes, Predicate<String> limitToAttributeNames, Predicate<String> ignoredAttributeNames) getMeta()
getValue()
<U> Optional
<U> Provides basic type casting/coercion useful for unknown valuesboolean
int
hashCode()
setTimestamp
(long timestamp) void
setTypeInternal
(ValueDescriptor<T> type) void
void
toString()
Methods inherited from class org.openremote.model.value.AbstractNameValueHolder
getName, getType, getTypeClass, setName
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.openremote.model.value.MetaHolder
getMetaItem, getMetaValue, hasMeta, hasMeta
-
Field Details
-
meta
-
timestamp
protected long timestamp
-
-
Constructor Details
-
Attribute
-
Attribute
-
Attribute
-
Attribute
-
Attribute
-
Attribute
-
Attribute
-
-
Method Details
-
getAddedOrModifiedAttributes
public static Stream<Attribute<?>> getAddedOrModifiedAttributes(Collection<Attribute<?>> oldAttributes, Collection<Attribute<?>> newAttributes) - Returns:
- All attributes that exist only in the new list or are different than any attribute in the old list.
-
getAddedOrModifiedAttributes
public static Stream<Attribute<?>> getAddedOrModifiedAttributes(Collection<Attribute<?>> oldAttributes, Collection<Attribute<?>> newAttributes, Predicate<String> ignoredAttributeNames) - Returns:
- All attributes that exist only in the new list or are different than any attribute in the old list.
-
getAddedOrModifiedAttributes
public static Stream<Attribute<?>> getAddedOrModifiedAttributes(Collection<Attribute<?>> oldAttributes, Collection<Attribute<?>> newAttributes, Predicate<String> limitToAttributeNames, Predicate<String> ignoredAttributeNames) - Returns:
- All attributes that exist only in the new list or are different than any attribute in the old list
-
getMeta
- Specified by:
getMeta
in interfaceMetaHolder
-
setMeta
-
addMeta
-
addMeta
-
addMeta
-
addOrReplaceMeta
-
addOrReplaceMeta
-
addOrReplaceMeta
-
getValue
- Specified by:
getValue
in interfaceValueHolder<T>
- Overrides:
getValue
in classAbstractNameValueHolder<T>
-
getValue
Description copied from interface:ValueHolder
Provides basic type casting/coercion useful for unknown values- Specified by:
getValue
in interfaceValueHolder<T>
- Overrides:
getValue
in classAbstractNameValueHolder<T>
-
setValue
- Overrides:
setValue
in classAbstractNameValueHolder<T>
-
setValue
-
getTimestamp
-
setTimestamp
-
hasExplicitTimestamp
public boolean hasExplicitTimestamp() -
setTypeInternal
-
toString
-
toStringAll
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractNameValueHolder<T>
-
equals
Super fast equality checking using the name, type and timestamp; when anAttribute
value is updated then the timestamp must be greater than the existing value timestamp; and also when merging anAsset
any modifiedAttribute
should have a newer timestamp; the backend should take care to update theAttribute
timestamp when merging anAsset
by usingdeepEquals(java.lang.Object)
.- Overrides:
equals
in classAbstractNameValueHolder<T>
-
deepEquals
-
equals
-
shallowClone
-