Class JourneyConditionsField

  • All Implemented Interfaces:

    
    public final class JourneyConditionsField
    
                        

    Condition spec for a journey node. Accepts a single condition atom, an AND/OR group, or an AND/OR nested group. Omit the conditions property entirely to express "no conditions".

    • Constructor Detail

    • Method Detail

      • conditionAtom

         final Optional<List<String>> conditionAtom()

        A single condition expressed as a positional tuple of strings.

        • Binary form (3 elements): [path, operator, value] where operator is one of is equal, is not equal, contains, does not contain, starts with, ends with, greater than, greater than or equal, less than, less than or equal.

        Example: ["user.tier", "is equal", "gold"].

        • Unary form (2 elements): [path, operator] where operator is one of exists, does not exist.

        Example: ["user.email", "exists"].

        The first element is a non-empty dot-path. The second element is the operator (must come from one of the two operator sets above). For the binary form, the third element is the comparison value (string). Runtime validation of the operator value and arity is performed by the backend; SDKs surface this as a string list.

      • asConditionAtom

         final List<String> asConditionAtom()

        A single condition expressed as a positional tuple of strings.

        • Binary form (3 elements): [path, operator, value] where operator is one of is equal, is not equal, contains, does not contain, starts with, ends with, greater than, greater than or equal, less than, less than or equal.

        Example: ["user.tier", "is equal", "gold"].

        • Unary form (2 elements): [path, operator] where operator is one of exists, does not exist.

        Example: ["user.email", "exists"].

        The first element is a non-empty dot-path. The second element is the operator (must come from one of the two operator sets above). For the binary form, the third element is the comparison value (string). Runtime validation of the operator value and arity is performed by the backend; SDKs surface this as a string list.

      • asConditionGroup

         final JourneyConditionGroup asConditionGroup()

        A leaf condition group. Exactly one of AND or OR must be present at runtime; each is a list of JourneyConditionAtom tuples.

      • accept

         final <T extends Any> T accept(JourneyConditionsField.Visitor<T> visitor)

        Maps this instance's current variant to a value of type T using the given visitor.

        Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:

        import com.courier.core.JsonValue;
        import java.util.Optional;
        
        Optional<String> result = journeyConditionsField.accept(new JourneyConditionsField.Visitor<Optional<String>>() {
            @Override
            public Optional<String> visitConditionAtom(List<String> conditionAtom) {
                return Optional.of(conditionAtom.toString());
            }
        
            // ...
        
            @Override
            public Optional<String> unknown(JsonValue json) {
                // Or inspect the `json`.
                return Optional.empty();
            }
        });
      • validate

         final JourneyConditionsField validate()

        Validates that the types of all values in this object match their expected types recursively.

        This method is not forwards compatible with new types from the API for existing fields.

      • ofConditionAtom

         final static JourneyConditionsField ofConditionAtom(List<String> conditionAtom)

        A single condition expressed as a positional tuple of strings.

        • Binary form (3 elements): [path, operator, value] where operator is one of is equal, is not equal, contains, does not contain, starts with, ends with, greater than, greater than or equal, less than, less than or equal.

        Example: ["user.tier", "is equal", "gold"].

        • Unary form (2 elements): [path, operator] where operator is one of exists, does not exist.

        Example: ["user.email", "exists"].

        The first element is a non-empty dot-path. The second element is the operator (must come from one of the two operator sets above). For the binary form, the third element is the comparison value (string). Runtime validation of the operator value and arity is performed by the backend; SDKs surface this as a string list.