Interface UpdateConstraint.Factory
- Enclosing interface:
- UpdateConstraint
An instance can be obtained by calling
Diffusion.updateConstraints()
.
-
Method Summary
Modifier and TypeMethodDescriptionCreate a constraint that partially matches the current topic value.locked
(Session.SessionLock lock) Create a constraint requiring a lock to be held by the session.noTopic()
Create a constraint requiring the path to have no topic.noValue()
Create a constraint requiring the topic to have no value.value
(UpdateConstraint.Operator operator, Object value) Create a constraint comparing the current value of a topic to a supplied value.default UpdateConstraint
Create a constraint requiring the current value of a topic to exactly match the supplied value.
-
Method Details
-
locked
Create a constraint requiring a lock to be held by the session.This can be used to coordinate operations between multiple sessions.
- Parameters:
lock
- the lock- Returns:
- the constraint
-
value
Create a constraint requiring the current value of a topic to exactly match the supplied value.This is exactly equivalent to calling
value(UpdateConstraint.Operator, Object)
specifying theIS
operator.- Parameters:
value
- the value- Returns:
- the constraint
- Throws:
IllegalArgumentException
- if the value type is not supported
-
value
Create a constraint comparing the current value of a topic to a supplied value.If a
String
value is supplied and the operator isEQ
orNE
, the string representation of the topic will be compared to the supplied value. This can only be used with primitive topic types (orTIME_SERIES
topics with a primitive event type). Other operators (other thanIS
) are not permitted with String values.If a number value is supplied (
Integer
,Long
orDouble
) the value will be compared with the number value of the topic. This will work withSTRING
,INT64
orDOUBLE
topics (orTIME_SERIES
topics with a primitive event type) only.STRING
topics can only be compared if they contain a value that can be parsed as a number. If the value of aSTRING
topic cannot be parsed as a number, or the topic is of any other non-number type the constraint will be unsatisfied. Any of the operators (other thanIS
) can be used with such number comparisons. Decimal numbers can be compared with integral numbers so1
is equal to1.0
,"1"
, or"1.0"
.If the
IS
operator is specified the specified value will be compared to the topic value for strict binary equality. The value type can be any value type supported byDataTypes
(Integer
is allowed and is treated as aLong
) or anyBytes
value and can be used to compare against any topic type.When a
STRING
,INT64
orDOUBLE
topic is updated to anull
value, the topic is set to have no value. Use thenoValue()
constraint to check if the topic has no value.This constraint is unsatisfied if no topic is present at the path.
- Parameters:
operator
- the operator that determines the type of comparisonvalue
- the value- Returns:
- the constraint
- Throws:
IllegalArgumentException
- if the the operator is not compatible with the value type or the value type is not supported- Since:
- 6.10
-
noValue
UpdateConstraint noValue()Create a constraint requiring the topic to have no value.This constraint is unsatisfied if no topic is present at the path.
- Returns:
- the constraint
-
noTopic
UpdateConstraint noTopic()Create a constraint requiring the path to have no topic.This is useful when setting the first value of a topic being added using
addAndSet
without changing the value if the topic already exists. This constraint is unsatisfied if a topic is present at the path.- Returns:
- the constraint
-
jsonValue
UpdateConstraint.PartialJSON jsonValue()Create a constraint that partially matches the current topic value.The topic must be a
JSON
topic (or aTIME_SERIES
topic with a json event type). TheUpdateConstraint.PartialJSON
partially describes the structure of aJSON
value. Thewith
orwithout
methods must be used to fully qualify the constraint.The constraint is unsatisfied if no topic is present at the path.
- Returns:
- the constraint
-