Class Bags
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.value.Bags
-
public final class Bags extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Bags.NonEmptinessValidator
Checks the bag is not empty, typically used to enforce MustBePresent=True on XACML AttributeDesignator/AttributeSelector elements
-
Field Summary
Fields Modifier and Type Field Description static Bag.Validator
DUMB_VALIDATOR
Dumb validator that does nothing, typically used for MustBePresent=False on XACML AttributeDesignator/AttributeSelector elements
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <AV extends AttributeValue>
Bag<AV>empty(Datatype<AV> elementDatatype, IndeterminateEvaluationException causeForEmpty)
Creates instance of immutable empty bag with given exception as reason for bag being empty (no attribute value), e.g.static <AV extends AttributeValue>
AttributeBag<AV>emptyAttributeBag(Datatype<AV> elementDatatype, IndeterminateEvaluationException causeForEmpty)
Creates instance of immutable empty attribute bag with given exception as reason for bag being empty (no attribute value), withAttributeSources.REQUEST
as attribute sourcestatic <AV extends AttributeValue>
AttributeBag<AV>emptyAttributeBag(Datatype<AV> elementDatatype, IndeterminateEvaluationException causeForEmpty, AttributeSource attributeValueSource)
Creates instance of immutable empty attribute bag containing val and only val value with given exception as reason for bag being empty (no attribute value), e.g.static <AV extends AttributeValue>
AttributeBag<AV>newAttributeBag(Datatype<AV> elementDatatype, Collection<AV> values)
Creates instance of immutable attribute bag withAttributeSources.REQUEST
as attribute source.static <AV extends AttributeValue>
AttributeBag<AV>newAttributeBag(Datatype<AV> elementDatatype, Collection<AV> values, AttributeSource attributeBagSource)
Creates instance of immutable attribute bag.static <AV extends AttributeValue>
Bag<AV>newBag(Datatype<AV> elementDatatype, Collection<AV> values)
Creates instance of immutable bag of values.static <AV extends AttributeValue>
Bag<AV>singleton(Datatype<AV> elementDatatype, AV val)
Creates instance of immutable bag containing val and only val valuestatic <AV extends AttributeValue>
AttributeBag<AV>singletonAttributeBag(Datatype<AV> elementDatatype, AV val)
Creates instance of immutable attribute bag containing val and only val value withAttributeSources.REQUEST
as attribute sourcestatic <AV extends AttributeValue>
AttributeBag<AV>singletonAttributeBag(Datatype<AV> elementDatatype, AV val, AttributeSource attributeValueSource)
Creates instance of immutable attribute bag containing val and only val value
-
-
-
Field Detail
-
DUMB_VALIDATOR
public static final Bag.Validator DUMB_VALIDATOR
Dumb validator that does nothing, typically used for MustBePresent=False on XACML AttributeDesignator/AttributeSelector elements
-
-
Method Detail
-
empty
public static <AV extends AttributeValue> Bag<AV> empty(Datatype<AV> elementDatatype, IndeterminateEvaluationException causeForEmpty) throws IllegalArgumentException
Creates instance of immutable empty bag with given exception as reason for bag being empty (no attribute value), e.g. error occurred during evaluation- Parameters:
causeForEmpty
- reason for empty bag (optional but should be specified whenever possible, to help troubleshoot)elementDatatype
- bag element datatype- Returns:
- bag
- Throws:
IllegalArgumentException
- ifelementDatatype == null
-
emptyAttributeBag
public static <AV extends AttributeValue> AttributeBag<AV> emptyAttributeBag(Datatype<AV> elementDatatype, IndeterminateEvaluationException causeForEmpty, AttributeSource attributeValueSource) throws IllegalArgumentException
Creates instance of immutable empty attribute bag containing val and only val value with given exception as reason for bag being empty (no attribute value), e.g. error occurred during evaluation,- Parameters:
elementDatatype
- bag element datatypecauseForEmpty
- reason for empty bag (optional but should be specified whenever possible, to help troubleshoot)attributeValueSource
- attribute value source- Returns:
- bag
- Throws:
IllegalArgumentException
- ifval == null || elementDatatype == null
-
emptyAttributeBag
public static <AV extends AttributeValue> AttributeBag<AV> emptyAttributeBag(Datatype<AV> elementDatatype, IndeterminateEvaluationException causeForEmpty) throws IllegalArgumentException
Creates instance of immutable empty attribute bag with given exception as reason for bag being empty (no attribute value), withAttributeSources.REQUEST
as attribute source- Parameters:
causeForEmpty
- reason for empty bag (optional but should be specified whenever possible, to help troubleshoot)elementDatatype
- bag element datatype- Returns:
- bag
- Throws:
IllegalArgumentException
- ifelementDatatype == null
-
singleton
public static <AV extends AttributeValue> Bag<AV> singleton(Datatype<AV> elementDatatype, AV val) throws IllegalArgumentException
Creates instance of immutable bag containing val and only val value- Parameters:
elementDatatype
- bag element datatypeval
- the val and only val value in the bag- Returns:
- bag
- Throws:
IllegalArgumentException
- ifval == null || elementDatatype == null
-
singletonAttributeBag
public static <AV extends AttributeValue> AttributeBag<AV> singletonAttributeBag(Datatype<AV> elementDatatype, AV val, AttributeSource attributeValueSource) throws IllegalArgumentException
Creates instance of immutable attribute bag containing val and only val value- Parameters:
elementDatatype
- bag element datatypeval
- the val and only val value in the bagattributeValueSource
- attribute value source- Returns:
- bag
- Throws:
IllegalArgumentException
- ifval == null || elementDatatype == null
-
singletonAttributeBag
public static <AV extends AttributeValue> AttributeBag<AV> singletonAttributeBag(Datatype<AV> elementDatatype, AV val) throws IllegalArgumentException
Creates instance of immutable attribute bag containing val and only val value withAttributeSources.REQUEST
as attribute source- Parameters:
elementDatatype
- bag element datatypeval
- the val and only val value in the bag- Returns:
- bag
- Throws:
IllegalArgumentException
- ifval == null || elementDatatype == null
-
newBag
public static <AV extends AttributeValue> Bag<AV> newBag(Datatype<AV> elementDatatype, Collection<AV> values) throws IllegalArgumentException
Creates instance of immutable bag of values.- Parameters:
values
- bag values, typically a List for ordered results, e.g. attribute values for which order matters; or it may be a Set for result of bag/Set functions (intersection, union...)elementDatatype
- bag element datatype- Returns:
- bag
- Throws:
IllegalArgumentException
- ifelementDatatype == null
orvalues
has at least one element which is null:values != null && !values.isEmpty() && values.iterator().next() == null
-
newAttributeBag
public static <AV extends AttributeValue> AttributeBag<AV> newAttributeBag(Datatype<AV> elementDatatype, Collection<AV> values, AttributeSource attributeBagSource) throws IllegalArgumentException
Creates instance of immutable attribute bag.- Parameters:
values
- bag values, typically a List for ordered results, e.g. attribute values for which order matters; or it may be a Set for result of bag/Set functions (intersection, union...)elementDatatype
- bag element datatypeattributeBagSource
- source of the attribute values- Returns:
- attribute bag
- Throws:
IllegalArgumentException
- ifelementDatatype == null
orvalues
has at least one element which is null:values != null && !values.isEmpty() && values.iterator().next() == null
-
newAttributeBag
public static <AV extends AttributeValue> AttributeBag<AV> newAttributeBag(Datatype<AV> elementDatatype, Collection<AV> values) throws IllegalArgumentException
Creates instance of immutable attribute bag withAttributeSources.REQUEST
as attribute source. UsenewAttributeBag(Datatype, Collection, AttributeSource)
instead if attribute bag comes from another source, e.g. AttributeProvider.- Parameters:
values
- bag values, typically a List for ordered results, e.g. attribute values for which order matters; or it may be a Set for result of bag/Set functions (intersection, union...)elementDatatype
- bag element datatype- Returns:
- attribute bag
- Throws:
IllegalArgumentException
- ifelementDatatype == null
orvalues
has at least one element which is null:values != null && !values.isEmpty() && values.iterator().next() == null
-
-