Package org.forgerock.openig.util
Class Condition
java.lang.Object
org.forgerock.openig.util.Condition
Hold a condition with a label.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Condition
An alwaysfalse
condition.static final org.forgerock.openig.model.component.UnionDefaultValue
static final Condition
An alwaystrue
condition.static final org.forgerock.openig.model.component.UnionDefaultValue
static final org.forgerock.openig.model.type.UnionTypeDefinition
TheTypeDefinition
of a condition. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
TYPE
public static final org.forgerock.openig.model.type.UnionTypeDefinition TYPETheTypeDefinition
of a condition. -
ALWAYS_TRUE
An alwaystrue
condition. -
ALWAYS_FALSE
An alwaysfalse
condition. -
ALWAYS_TRUE_DEFAULT
public static final org.forgerock.openig.model.component.UnionDefaultValue ALWAYS_TRUE_DEFAULT -
ALWAYS_FALSE_DEFAULT
public static final org.forgerock.openig.model.component.UnionDefaultValue ALWAYS_FALSE_DEFAULT
-
-
Constructor Details
-
Condition
Create a new Condition.- Parameters:
expression
- the expression which will be evaluatedlabel
- its associated label
-
Condition
Creates a new condition.- Parameters:
expression
- the expression that yield the condition- Throws:
ExpressionException
-
-
Method Details
-
condition
Maps aJsonValue
toCondition
. Three forms of condition are allowed:- Static boolean, such as:
"myCondition": true
- Inline expression, such as
"myCondition": "${true}"
- Labeled expression, such as
"myCondition": {"expression": "${true}", "label": "..."}
Usage:
Condition condition = jsonValue.as(condition(initialBindings()))
- Static boolean, such as:
-
test
Test the condition. Guaranteed to never throwRuntimeException
synchronously.- Parameters:
bindings
- the bindings to pass to the underlying expression- Returns:
- a promise of a boolean result
-
label
Returns the label of this condition.- Returns:
- the label of this condition
-