Class GenericAttributeProviderBasedAttributeDesignatorExpression<AV extends AttributeValue>

    • Constructor Detail

      • GenericAttributeProviderBasedAttributeDesignatorExpression

        public GenericAttributeProviderBasedAttributeDesignatorExpression​(AttributeFqn attributeName,
                                                                          boolean mustBePresent,
                                                                          BagDatatype<AV> resultDatatype,
                                                                          SingleNamedAttributeProvider<AV> attributeProvider)
        Return an instance of an AttributeDesignator based on an AttributeDesignatorType
        Parameters:
        attributeName - the AttributeDesignatorType we want to convert
        mustBePresent - AttributeDesignator's MustBePresent
        resultDatatype - expected datatype of the result attribute value ( AV is the expected type of every element in the bag)
        attributeProvider - Attribute Provider responsible for finding the values of the attribute designated by attributeName in a given evaluation context at runtime. When evaluate(EvaluationContext, Optional) is called, all AttributeProvider(s) are called in the list order
        Throws:
        IllegalArgumentException - if attrDesignator.getCategory() == null || attrDesignator.getAttributeId() == null
    • Method Detail

      • getValue

        public Optional<Bag<AV>> getValue()
        Get the constant value of this expression if it has a constant value, i.e. independent of the evaluation context (e.g. AttributeValue, VariableReference to AttributeValue...). This is equivalent to call Expression.evaluate(EvaluationContext, Optional) with individualDecisionContext == null and mdpContext == Optional.empty(). This enables expression consumers to do optimizations, e.g. functions may pre-compile/pre-evaluate parts of their inputs knowing some are constant values.
        Specified by:
        getValue in interface Expression<AV extends AttributeValue>
        Returns:
        the constant value iff the expression has a static/fixed/constant value, else no present value. NB: Null is not considered/possible as a constant value for expressions.
      • isNonEmptyBagRequired

        public boolean isNonEmptyBagRequired()
        Description copied from interface: AttributeDesignatorExpression
        Indicates whether the attribute's presence is required, i.e. it must have at least one value in this context (non-empty bag). Equivalent of XACML MustBePresent flag.
        Specified by:
        isNonEmptyBagRequired in interface AttributeDesignatorExpression<AV extends AttributeValue>
        Returns:
        true iff the resulting bag must be non-empty, i.e. there must be at least one value for this attribute in the context
      • evaluate

        public Bag<AV> evaluate​(EvaluationContext individualDecisionContext,
                                Optional<EvaluationContext> mdpContext)
                         throws IndeterminateEvaluationException
        Description copied from interface: Expression
        Evaluates the expression using the given context.
        Specified by:
        evaluate in interface Expression<AV extends AttributeValue>
        Parameters:
        individualDecisionContext - Individual Decision)request context
        mdpContext - the context of the Multiple Decision request that the individualDecisionContext belongs to if the Multiple Decision Profile is used.
        Returns:
        the result of evaluation that may be a single value T (e.g. function result, AttributeValue, Condition, Match...) or bag of values (e.g. AttributeDesignator, AttributeSelector)
        Throws:
        IndeterminateEvaluationException - if evaluation is "Indeterminate" (see XACML core specification)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object obj)
        Equal iff the Attribute Category/Issuer/Id are equal
        Overrides:
        equals in class Object