public class Condition extends Object implements Evaluatable
Constructor and Description |
---|
Condition(Expression expression)
Constructs a
Condition as used in XACML 2.0. |
Condition(Function function,
List expressions)
Constructs a
Condition as used in XACML 1.x. |
Modifier and Type | Method and Description |
---|---|
String |
encode()
Encodes this
Condition into its XML form |
void |
encode(StringBuilder builder)
Encodes this
Condition into its XML form and writes this out to the provided
StringBuilder |
EvaluationResult |
evaluate(EvaluationCtx context)
Evaluates the
Condition by evaluating its child Expression . |
boolean |
evaluatesToBag()
Deprecated.
As of 2.0, you should use the
returnsBag method from the
super-interface Expression . |
List |
getChildren()
Returns the
List of children for this Condition . |
Function |
getFunction()
Returns the
Function used by this Condition if this is a 1.x
condition, or null if this is a 2.0 condition. |
static Condition |
getInstance(Node root,
PolicyMetaData metaData,
VariableManager manager)
Returns an instance of
Condition based on the given DOM root. |
URI |
getType()
Returns the type of attribute that this object will return on a call to
evaluate
. |
boolean |
returnsBag()
Returns whether or not this
Condition will return a bag of values on evaluation. |
public Condition(Function function, List expressions) throws IllegalArgumentException
Condition
as used in XACML 1.x.function
- the Function
to use in evaluating the elements in the Conditionexpressions
- the contents of the Condition which will be the parameters to the function, each
of which is an Expression
IllegalArgumentException
- if the input expressions don't match the signature of the
function or if the function is invalid for use in a Conditionpublic Condition(Expression expression) throws IllegalArgumentException
Condition
as used in XACML 2.0.expression
- the child Expression
IllegalArgumentException
- if the expression is not boolean or returns a bagpublic static Condition getInstance(Node root, PolicyMetaData metaData, VariableManager manager) throws ParsingException
Condition
based on the given DOM root.root
- the DOM root of a ConditionType XML typemetaData
- the meta-data associated with the containing policymanager
- VariableManager
used to connect references and definitions while
parsingParsingException
- if this is not a valid ConditionTypepublic Function getFunction()
Function
used by this Condition
if this is a 1.x
condition, or null if this is a 2.0 condition.Function
or nullpublic List getChildren()
List
of children for this Condition
. The
List
contains Expression
s. The list is unmodifiable.getChildren
in interface Evaluatable
List
of Expression
spublic URI getType()
evaluate
. This is always a boolean, since that's all that a Condition is allowed to return.getType
in interface Expression
public boolean returnsBag()
Condition
will return a bag of values on evaluation.
This always returns false, since a Condition isn't allowed to return a bag.returnsBag
in interface Expression
public boolean evaluatesToBag()
returnsBag
method from the
super-interface Expression
.Condition
will return a bag of values on evaluation.
This always returns false, since a Condition isn't allowed to return a bag.evaluatesToBag
in interface Evaluatable
public EvaluationResult evaluate(EvaluationCtx context)
Condition
by evaluating its child Expression
.evaluate
in interface Evaluatable
context
- the representation of the requestpublic String encode()
Condition
into its XML formString
public void encode(StringBuilder builder)
Condition
into its XML form and writes this out to the provided
StringBuilder
encode
in interface Expression
builder
- string stream into which the XML-encoded data is writtenCopyright © 2015 WSO2. All rights reserved.