Skip navigation links
org.wso2.balana.attr

Class AttributeValue

    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected AttributeValue(URI type)
      Constructor that takes the specific attribute type.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      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.
    • Constructor Detail

      • AttributeValue

        protected AttributeValue(URI type)
        Constructor that takes the specific attribute type.
        Parameters:
        type - the attribute's type
    • Method Detail

      • getType

        public 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 Expression
        Returns:
        the attribute's type
      • returnsBag

        public final boolean returnsBag()
        Returns whether or not this value is actually a bag of values. This is a required interface from Expression, 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:
        returnsBag in interface Expression
        Returns:
        true if this is a bag of values, false otherwise
      • evaluatesToBag

        public final boolean evaluatesToBag()
        Deprecated. As of 2.0, you should use the returnsBag method from the super-interface Expression.
        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 Evaluatable
        Returns:
        true if this is a bag of values, false otherwise
      • getChildren

        public List getChildren()
        Always returns an empty list since values never have children.
        Specified by:
        getChildren in interface Evaluatable
        Returns:
        an empty List
      • 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.
        Returns:
        true if this is a bag of values, false otherwise
      • evaluate

        public EvaluationResult evaluate(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 Evaluatable
        Parameters:
        context - the representation of the request
        Returns:
        a successful evaluation containing this value
      • encode

        public abstract 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.
        Returns:
        a String form of the value
      • encode

        public 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.
        Specified by:
        encode in interface Expression
        Parameters:
        builder - string stream into which the XML-encoded data is written
      • encodeWithTags

        public 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.
        Parameters:
        includeType - include the DataType XML attribute if true, exclude if false
        Returns:
        a String encoding including the XML tags

Copyright © 2022 WSO2. All rights reserved.