Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface UpdateConstraintFactory

Factory for the constraint types.

An instance can be obtained by calling diffusion.updateConstraints().

since

6.2

Hierarchy

  • UpdateConstraintFactory

Index

Methods

jsonValue

  • Create a constraint that partially matches the current topic value.

    The topic must be a JSON topic (or a TIME_SERIES topic with a json event type). The PartialJSON partially describes the structure of a JSON value. The with or without methods must be used to fully qualify the constraint.

    This constraint is useful when changing the value of a topic. The constraint is unsatisfied if no topic is present at the path, making it unsuitable for operations that try to add topics.

    Returns PartialJSON

    the constraint

locked

  • Create a constraint requiring a lock to be held by the session.

    This can be used to coordinate operations between multiple sessions.

    Parameters

    Returns UpdateConstraint

    the constraint

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 an UpdateStream without changing the value if the topic already exists. This constraint is unsatisfied if a topic is present at the path, making it unsuitable for operations that try to set topics without adding them.

    Returns UpdateConstraint

    the constraint

noValue

  • Create a constraint requiring the topic to have no value.

    This is useful when setting the first value of a topic. This constraint is unsatisfied if no topic is present at the path, making it unsuitable for operations that try to add topics.

    Returns UpdateConstraint

    the constraint

value

  • Create a constraint requiring the current value of the topic to exactly match the supplied value.

    This is exactly equivalent to calling value(UpdateConstraint.Operator, Object) specifying the IS operator.

    throws

    an IllegalArgumentError if the value cannot be serialised

    throws

    a NullValueError if the value argument is null

    Parameters

    • value: any

      the value

    • Optional dataType: DataType<any, any, any>

      the optional type of the values

    Returns UpdateConstraint

    the constraint

  • Create a constraint comparing the current value of a topic to a supplied value.

    If a String value is supplied and the operator is EQ or NE, the string representation of the topic will be compared to the supplied value. This can only be used with primitive topic types (or TIME_SERIES topics with a primitive event type). Other operators (other than IS) are not permitted with String values.

    If a number value is supplied (Int64 or Double) the value will be compared with the number value of the topic. This will work with STRING, INT64 or DOUBLE topics (or TIME_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 a STRING 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 than IS) can be used with such number comparisons. Decimal numbers can be compared with integral numbers so {@code 1} is equal to {@code 1.0}, {@code "1"}, or {@code "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 by DataTypes or any Bytes value and can be used to compare against any topic type.

    When a STRING, INT64 or DOUBLE topic is updated to a {@code null} value, the topic is set to have no value. Use the noValue() constraint to check if the topic has no value.

    This constraint is useful when changing the value of a topic. This constraint is unsatisfied if no topic is present at the path, making it unsuitable for operations that try to add topics.

    throws

    an IllegalArgumentError if the value cannot be serialised or the operator is invalid for the value type

    throws

    a NullValueError if any of the required arguments are null

    since

    6.10

    Parameters

    Returns UpdateConstraint

    the constraint