public abstract class AttributeValue extends Object implements Evaluatable
AttributeValues. If you want to
provide a new type, extend this class and implement the
equals(Object)
and hashCode
methods from Object
, which are
used for equality checking.
Modifier | Constructor and Description |
---|---|
protected |
AttributeValue(URI type)
Constructor that takes the specific attribute type.
|
Modifier and Type | Method and Description |
---|---|
abstract String |
encode()
Encodes the value in a form suitable for including in XML data like a request or an
obligation.
|
void |
encode(StringBuilder builder)
Encodes this
AttributeValue into its XML representation and writes this encoding
to the given StringBuilder This will always produce the version
used in a policy rather than that used in a request, so this is equivalent to calling
encodeWithTags(true) and then stuffing that into a stream. |
String |
encodeWithTags(boolean includeType)
Encodes the value and includes the AttributeValue XML tags so that the resulting string can
be included in a valid XACML policy or Request/Response.
|
EvaluationResult |
evaluate(EvaluationCtx context)
Implements the required interface from
Evaluatable . |
boolean |
evaluatesToBag()
Deprecated.
As of 2.0, you should use the
returnsBag method from the
super-interface Expression . |
List |
getChildren()
Always returns an empty list since values never have children.
|
URI |
getType()
Returns the type of this attribute value.
|
boolean |
isBag()
Returns whether or not this value is actually a bag of values.
|
boolean |
returnsBag()
Returns whether or not this value is actually a bag of values.
|
protected AttributeValue(URI type)
type
- the attribute's typepublic URI getType()
getType
in interface Expression
public final boolean returnsBag()
Expression
, but the more meaningful isBag
method is used by
AttributeValue
s, so this method is declared as final and calls the
isBag
method for this value.returnsBag
in interface Expression
public final boolean evaluatesToBag()
returnsBag
method from the
super-interface Expression
.Evaluatable
, but the more meaningful isBag
method is used by
AttributeValue
s, so this method is declared as final and calls the
isBag
method for this value.evaluatesToBag
in interface Evaluatable
public List getChildren()
getChildren
in interface Evaluatable
List
public boolean isBag()
false
. Typically, only the BagAttribute
should ever override this
to return true
.public EvaluationResult evaluate(EvaluationCtx context)
Evaluatable
. Since there is nothing to
evaluate in an attribute value, the default result is just this instance. Override this
method if you want special behavior, like a dynamic value.evaluate
in interface Evaluatable
context
- the representation of the requestpublic abstract String encode()
String
form of the valuepublic void encode(StringBuilder builder)
AttributeValue
into its XML representation and writes this encoding
to the given StringBuilder
This will always produce the version
used in a policy rather than that used in a request, so this is equivalent to calling
encodeWithTags(true)
and then stuffing that into a stream.encode
in interface Expression
builder
- string stream into which the XML-encoded data is writtenpublic String encodeWithTags(boolean includeType)
boolean
parameter
lets you include the DataType attribute, which is required in a policy but not allowed in a
Request or Response.includeType
- include the DataType XML attribute if true
, exclude if
false
String
encoding including the XML tagsCopyright © 2016 WSO2. All rights reserved.