Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sun.xacml.attr
Class BagAttribute  view BagAttribute download BagAttribute.java

java.lang.Object
  extended bycom.sun.xacml.attr.AttributeValue
      extended bycom.sun.xacml.attr.BagAttribute
All Implemented Interfaces:
com.sun.xacml.cond.Evaluatable

public class BagAttribute
extends AttributeValue

Represents a bag used in the XACML spec as return values from functions and designators/selectors that provide more than one value. All values in the bag are of the same type, and the bag may be empty. The bag is immutable, although its contents may not be.

NOTE: This is the one standard attribute type that can't be created from the factory, since you can't have this in an XML block (it is used only in return values & dynamic inputs). I think this is right, but we may need to add some functionality to let this go into the factory.

Since:
1.0

Nested Class Summary
private  class BagAttribute.ImmutableIterator
          This is a version of Iterator that overrides the remove method so that items can't be taken out of the bag.
 
Field Summary
private  java.util.Collection bag
           
 
Fields inherited from class com.sun.xacml.attr.AttributeValue
 
Constructor Summary
BagAttribute(java.net.URI type, java.util.Collection bag)
          Creates a new BagAttribute that represents the Collection of AttributeValues supplied.
 
Method Summary
 boolean contains(AttributeValue value)
          Returns true if this set contains the specified value.
 boolean containsAll(BagAttribute bag)
          Returns true if this bag contains all of the values of the specified bag.
static BagAttribute createEmptyBag(java.net.URI type)
          Convenience function that returns a bag with no elements
 java.lang.String encode()
          Because a bag cannot be included in a request/response or a policy, this will always throw an UnsupportedOperationException.
 boolean isBag()
          Overrides the default method to always return true.
 boolean isEmpty()
          A convenience function that returns whether or not the bag is empty (ie, whether or not the size of the bag is zero)
 java.util.Iterator iterator()
          Returns an iterator over te
 int size()
          Returns the number of elements in this bag
 
Methods inherited from class com.sun.xacml.attr.AttributeValue
encode, encode, encodeWithTags, evaluate, evaluatesToBag, getChildren, getType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bag

private java.util.Collection bag
Constructor Detail

BagAttribute

public BagAttribute(java.net.URI type,
                    java.util.Collection bag)
Creates a new BagAttribute that represents the Collection of AttributeValues supplied. If the set is null or empty, then the new bag is empty.

Method Detail

isBag

public boolean isBag()
Overrides the default method to always return true.

Overrides:
isBag in class AttributeValue

createEmptyBag

public static BagAttribute createEmptyBag(java.net.URI type)
Convenience function that returns a bag with no elements


isEmpty

public boolean isEmpty()
A convenience function that returns whether or not the bag is empty (ie, whether or not the size of the bag is zero)


size

public int size()
Returns the number of elements in this bag


contains

public boolean contains(AttributeValue value)
Returns true if this set contains the specified value. More formally, returns true if and only if this bag contains a value v such that (value==null ? v==null : value.equals(v)). Note that this will only work correctly if the AttributeValue has overridden the equals method.


containsAll

public boolean containsAll(BagAttribute bag)
Returns true if this bag contains all of the values of the specified bag. Note that this will only work correctly if the AttributeValue type contained in the bag has overridden the equals method.


iterator

public java.util.Iterator iterator()
Returns an iterator over te


encode

public java.lang.String encode()
Because a bag cannot be included in a request/response or a policy, this will always throw an UnsupportedOperationException.

Specified by:
encode in class AttributeValue