java.lang.Object
com.sun.xacml.attr.AttributeValue
- All Implemented Interfaces:
- com.sun.xacml.cond.Evaluatable
- Direct Known Subclasses:
- AnyURIAttribute, BagAttribute, Base64BinaryAttribute, BooleanAttribute, DateAttribute, DateTimeAttribute, DayTimeDurationAttribute, DoubleAttribute, HexBinaryAttribute, IntegerAttribute, RFC822NameAttribute, StringAttribute, TimeAttribute, X500NameAttribute, YearMonthDurationAttribute
- public abstract class AttributeValue
- extends java.lang.Object
- implements com.sun.xacml.cond.Evaluatable
The base type for all datatypes used in a policy or request/response,
this abstract class represents a value for a given attribute type.
All the required types defined in the XACML specification are
provided as instances of 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.
- Since:
- 1.0
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
type
private java.net.URI type
AttributeValue
protected AttributeValue(java.net.URI type)
- Constructor that takes the specific attribute type.
getType
public java.net.URI getType()
- Returns the type of this attribute value. By default this always
returns the type passed to the constructor.
- Specified by:
getType in interface com.sun.xacml.cond.Evaluatable
evaluatesToBag
public final boolean evaluatesToBag()
- Returns whether or not this value is actually a bag of values. This
is a required interface from
Evaluatable, but the
more meaningful isBag method is used by
AttributeValues, so this method is declared as final
and calls the isBag method for this value.
- Specified by:
evaluatesToBag in interface com.sun.xacml.cond.Evaluatable
getChildren
public java.util.List getChildren()
- Always returns an empty list since values never have children.
- Specified by:
getChildren in interface com.sun.xacml.cond.Evaluatable
isBag
public boolean isBag()
- Returns whether or not this value is actually a bag of values. By
default this returns
false. Typically, only the
BagAttribute should ever override this to return
true.
evaluate
public com.sun.xacml.cond.EvaluationResult evaluate(com.sun.xacml.EvaluationCtx context)
- Implements the required interface from
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.
- Specified by:
evaluate in interface com.sun.xacml.cond.Evaluatable
encode
public abstract java.lang.String encode()
- Encodes the value in a form suitable for including in XML data like
a request or an obligation. This must return a value that could in
turn be used by the factory to create a new instance with the same
value.
encode
public void encode(java.io.OutputStream output)
- Encodes this
AttributeValue into its XML representation
and writes this encoding to the given OutputStream with
no indentation. 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.
- Specified by:
encode in interface com.sun.xacml.cond.Evaluatable
encode
public void encode(java.io.OutputStream output,
com.sun.xacml.Indenter indenter)
- Encodes this
AttributeValue into its XML representation
and writes this encoding to the given OutputStream with
indentation. 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.
- Specified by:
encode in interface com.sun.xacml.cond.Evaluatable
encodeWithTags
public java.lang.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. The
boolean parameter lets you include
the DataType attribute, which is required in a policy but not allowed
in a Request or Response.