Interface AttributeValueFactoryRegistry

    • Method Detail

      • newExpression

        ConstantExpression<? extends AttributeValue> newExpression​(String datatypeId,
                                                                   List<Serializable> content,
                                                                   Map<QName,​String> otherAttributes,
                                                                   net.sf.saxon.s9api.XPathCompiler xPathCompiler)
                                                            throws IllegalArgumentException
        Create internal model's AttributeValue expression
        Parameters:
        datatypeId - attribute datatype ID
        content - raw value's mixed content, e.g. an element might be a String for text, or Element for XML element in the case of core XACML (XML) implemented with JAXB framework; or possibly Number or Boolean in the case of JSON Profile of XACML implemented with common JSON frameworks. This list is a singleton in most cases.
        otherAttributes - (mandatory) other XML attributes of the value node, may be empty if none (but not null)
        xPathCompiler - XPath compiler for evaluating/compiling any XPath expression in value
        Returns:
        expression, e.g. ConstantExpression for constant AttributeValues, or something like XPathExpression for context-dependent xpathExpression-type of AttributeValues (quite similar to AttributeSelector)
        Throws:
        IllegalArgumentException - value datatype unknown/not supported, or if value cannot be parsed into the value's defined datatype
      • getCompatibleFactory

        AttributeValueFactory<?> getCompatibleFactory​(Class<? extends Serializable> rawValueClass)
        Get value factory that can handle a given class of Java values
        Parameters:
        rawValueClass - class of the raw value
        Returns:
        compatible attribute value factory; null if none
      • newAttributeBag

        AttributeBag<?> newAttributeBag​(Collection<? extends Serializable> rawValues,
                                        AttributeSource attributeValueSource)
                                 throws UnsupportedOperationException,
                                        IllegalArgumentException
        Creates an AttributeBag (bag of AttributeValues) from collection of raw values using best compatible AttributeValueFactory available in this registry; compatible means that it supports the raw value types as input types. Beware that a bag has a single (XACML) datatype, so all value types must correspond to a single (XACML) datatype. Therefore, to prevent unexpected behavior, rawVals should all have the same concrete type. In other words, mixing different concrete Java types may cause IllegalArgumentException. For example, do not mix Integer (likely to be mapped to XACML integer) and Double (likely to be map to XACML double).
        Parameters:
        rawValues - raw values to be converted to AttributeBag
        attributeValueSource - attribute value source
        Returns:
        corresponding AttributeBag in internal model for (XACML) policy evaluation
        Throws:
        IllegalArgumentException - if one of the rawValues is of the right type but actual value content is not valid for the selected (best compatible available) AttributeValueFactory (for example, some factories for numeric input, e.g. integer or double, may not support all kinds of integer (from -Infinity to +Infinity) but only in a limited range); or rawValues do not have a common type that can be mapped to a common (XACML) AttributeValue datatype, i.e. the input type mixing is not allowed by the factory.
        UnsupportedOperationException - if one of the rawValues does not have a type supported by any AttributeValueFactory as input type in this registry