Class JourneyConditionsField
-
- All Implemented Interfaces:
public final class JourneyConditionsFieldCondition spec for a journey node. Accepts a single condition atom, an AND/OR group, or an AND/OR nested group. Omit the
conditionsproperty entirely to express "no conditions".
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceJourneyConditionsField.VisitorAn interface that defines how to map each variant of JourneyConditionsField to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<List<String>>conditionAtom()A single condition expressed as a positional tuple of strings. final Optional<JourneyConditionGroup>conditionGroup()A leaf condition group. final Optional<JourneyConditionNestedGroup>conditionNestedGroup()A nested condition group. final BooleanisConditionAtom()final BooleanisConditionGroup()final BooleanisConditionNestedGroup()final List<String>asConditionAtom()A single condition expressed as a positional tuple of strings. final JourneyConditionGroupasConditionGroup()A leaf condition group. final JourneyConditionNestedGroupasConditionNestedGroup()A nested condition group. final Optional<JsonValue>_json()final <T extends Any> Taccept(JourneyConditionsField.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final JourneyConditionsFieldvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static JourneyConditionsFieldofConditionAtom(List<String> conditionAtom)A single condition expressed as a positional tuple of strings. final static JourneyConditionsFieldofConditionGroup(JourneyConditionGroup conditionGroup)A leaf condition group. final static JourneyConditionsFieldofConditionNestedGroup(JourneyConditionNestedGroup conditionNestedGroup)A nested condition group. -
-
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]whereoperatoris one ofis 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]whereoperatoris one ofexists,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.
-
conditionGroup
final Optional<JourneyConditionGroup> conditionGroup()
A leaf condition group. Exactly one of
ANDorORmust be present at runtime; each is a list ofJourneyConditionAtomtuples.
-
conditionNestedGroup
final Optional<JourneyConditionNestedGroup> conditionNestedGroup()
A nested condition group. Exactly one of
ANDorORmust be present at runtime; each is a list ofJourneyConditionGroupitems.
-
isConditionAtom
final Boolean isConditionAtom()
-
isConditionGroup
final Boolean isConditionGroup()
-
isConditionNestedGroup
final Boolean isConditionNestedGroup()
-
asConditionAtom
final List<String> asConditionAtom()
A single condition expressed as a positional tuple of strings.
Binary form (3 elements):
[path, operator, value]whereoperatoris one ofis 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]whereoperatoris one ofexists,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
ANDorORmust be present at runtime; each is a list ofJourneyConditionAtomtuples.
-
asConditionNestedGroup
final JourneyConditionNestedGroup asConditionNestedGroup()
A nested condition group. Exactly one of
ANDorORmust be present at runtime; each is a list ofJourneyConditionGroupitems.
-
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]whereoperatoris one ofis 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]whereoperatoris one ofexists,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.
-
ofConditionGroup
final static JourneyConditionsField ofConditionGroup(JourneyConditionGroup conditionGroup)
A leaf condition group. Exactly one of
ANDorORmust be present at runtime; each is a list ofJourneyConditionAtomtuples.
-
ofConditionNestedGroup
final static JourneyConditionsField ofConditionNestedGroup(JourneyConditionNestedGroup conditionNestedGroup)
A nested condition group. Exactly one of
ANDorORmust be present at runtime; each is a list ofJourneyConditionGroupitems.
-
-
-
-