com.att.research.xacmlatt.pdp.policy.Bag Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xacml-pdp Show documentation
Show all versions of xacml-pdp Show documentation
ATT reference implementation of XACML PDP engine
/*
*
* Copyright (c) 2013,2019 AT&T Knowledge Ventures
* SPDX-License-Identifier: MIT
*/
package com.att.research.xacmlatt.pdp.policy;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.att.research.xacml.api.AttributeValue;
/**
* Bag represents a collection of XACML attribute values for the same attribute.
*
* @author car
* @version $Revision: 1.1 $
*/
public class Bag {
public static final Bag EMPTY = new Bag();
private List> attributeValues = new ArrayList>();
/**
* Gets the List
of AttributeValue
s for this Bag
.
*
* @return the List
of AttributeValue
s for this Bag
*/
public List> getAttributeValueList() {
return this.attributeValues;
}
/**
* Creates a new, empty Bag
.
*/
public Bag() {
}
/**
* Creates a new Bag
by copying the {@link com.att.research.xacml.api.AttributeValue}s from the
* given Collection
.
*
* @param attributeValuesIn the Collection
of AttributeValue
s for this Bag
.
*
public Bag(Collection> attributeValuesIn) {
if (attributeValuesIn != null) {
this.attributeValues.addAll(attributeValuesIn);
}
}
public Bag(Iterator> iterAttributeValuesIn) {
if (iterAttributeValuesIn != null) {
while (iterAttributeValuesIn.hasNext()) {
this.attributeValues.add(iterAttributeValuesIn.next());
}
}
}
*/
/**
* Adds an AttributeValue
to this Bag
>
*
* @param attributeValue the AttributeValue
to add
*/
public void add(AttributeValue> attributeValue) {
this.attributeValues.add(attributeValue);
}
/**
* Gets the number of AttributeValue
s in this Bag
.
*
* @return the number of AttributeValue
s in this Bag
.
*/
public int size() {
return this.getAttributeValueList().size();
}
/**
* Gets an Iterator
over all of the AttributeValue
s in this Bag
.
*
* @return an Iterator
over all of the AttributeValue
s in this Bag
.
*/
public Iterator> getAttributeValues() {
return this.getAttributeValueList().iterator();
}
}