Class AttributesImpl
- java.lang.Object
-
- org.glassfish.security.services.impl.common.AttributesImpl
-
- All Implemented Interfaces:
Attributes
- Direct Known Subclasses:
AzAttributesImpl
public class AttributesImpl extends Object implements Attributes
-
-
Constructor Summary
Constructors Constructor Description AttributesImpl()AttributesImpl(AttributesImpl other)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(String name, String[] values, boolean replace)Add the specified attribute to the attributes collection.voidaddAttribute(String name, String value, boolean replace)Add the specified attribute to the attributes collection.voidaddAttribute(String name, Set<String> values, boolean replace)Add the specified attribute to the attributes collection.voidclear()Removes all attributes from the collection.AttributegetAttribute(String name)Get the Attribute object for the named attribute, if present.intgetAttributeCount()Get a count of the number of Attributes (not attribute values) in this Attributes object.Set<String>getAttributeNames()Get the attribute names, as a Set.StringgetAttributeValue(String name)Get the value of the specified attribute, if present.Set<String>getAttributeValues(String name)Get the Set of values for the specified attribute, if present.String[]getAttributeValuesAsArray(String name)Get the set of values for the specified attribute as a String array.voidremoveAllAttributeValues(String name)Remove all values associated with the named attribute, but do not remove the attribute from the collection.voidremoveAttribute(String name)Remove the specified attribute from the collection.voidremoveAttributeValue(String name, String value)Remove the specified value from the named attribute.voidremoveAttributeValues(String name, String[] values)Remove the specified values from the named attribute.voidremoveAttributeValues(String name, Set<String> values)Remove the specified values from the named attribute.
-
-
-
Constructor Detail
-
AttributesImpl
public AttributesImpl()
-
AttributesImpl
public AttributesImpl(AttributesImpl other)
Copy constructor
-
-
Method Detail
-
getAttributeCount
public int getAttributeCount()
Description copied from interface:AttributesGet a count of the number of Attributes (not attribute values) in this Attributes object.- Specified by:
getAttributeCountin interfaceAttributes- Returns:
- The attribute count.
-
getAttributeNames
public Set<String> getAttributeNames()
Description copied from interface:AttributesGet the attribute names, as a Set. This set is read-only; updating it will not change the underlying attributes collection.- Specified by:
getAttributeNamesin interfaceAttributes- Returns:
- The attribute names Set.
-
getAttribute
public Attribute getAttribute(String name)
Description copied from interface:AttributesGet the Attribute object for the named attribute, if present.- Specified by:
getAttributein interfaceAttributes- Parameters:
name- The name of the Attribute to get.- Returns:
- The Attribute, or null if an attribute by that name is not present.
-
getAttributeValue
public String getAttributeValue(String name)
Description copied from interface:AttributesGet the value of the specified attribute, if present. Note that, for multi-valued attributes, The value returned is whichever value is returned first by the underlying Set implementation; there are no ordering guarantees. As such, this method is primarily useful as a shorthand method for attributes known (or expected) by the caller to be single-valued. Note also that it is not possible, using this method, to distinguish between a missing attribute and an attribute that is present but has no values. In both cases, null is returned.- Specified by:
getAttributeValuein interfaceAttributes- Parameters:
name- The name of the attribute whose value is wanted.- Returns:
- The attribute value, or null if the attribute is missing or has no values.
-
getAttributeValues
public Set<String> getAttributeValues(String name)
Description copied from interface:AttributesGet the Set of values for the specified attribute, if present.- Specified by:
getAttributeValuesin interfaceAttributes- Parameters:
name- The name of the attribute whose values are wanted.- Returns:
- The Set of values, or null if the attribute is not present in the collection. If the attribute is present but has no values, an empty Set is returned.
-
getAttributeValuesAsArray
public String[] getAttributeValuesAsArray(String name)
Description copied from interface:AttributesGet the set of values for the specified attribute as a String array.- Specified by:
getAttributeValuesAsArrayin interfaceAttributes- Parameters:
name- The name of the attribute whose values are wanted.- Returns:
- The array of values, or null if the attribute is not present in the collection. If the attribute is present but has no values, a zero-length array is returned.
-
addAttribute
public void addAttribute(String name, String value, boolean replace)
Description copied from interface:AttributesAdd the specified attribute to the attributes collection. Remove any existing values if the replace parameter is true, otherwise add the new value to the existing values. Duplicate values are silently dropped.- Specified by:
addAttributein interfaceAttributes- Parameters:
name- The name of the attribute to add.value- The single attribute value to add.replace- If true, replace the existing attribute and any existing values. If false, add the new value to those that are already present.
-
addAttribute
public void addAttribute(String name, Set<String> values, boolean replace)
Description copied from interface:AttributesAdd the specified attribute to the attributes collection. Remove any existing values if the replace parameter is true, otherwise add the new values to the existing values. Duplicate values are silently dropped.- Specified by:
addAttributein interfaceAttributes- Parameters:
name- The name of the attribute to add.replace- If true, replace the existing attribute and any existing values. If false, add the new values to those that are already present.
-
addAttribute
public void addAttribute(String name, String[] values, boolean replace)
Description copied from interface:AttributesAdd the specified attribute to the attributes collection. Remove any existing values if the replace parameter is true, otherwise add the new values to the existing values. Duplicate values are silently dropped.- Specified by:
addAttributein interfaceAttributes- Parameters:
name- The name of the attribute to add.replace- If true, replace the existing attribute and any existing values. If false, add the new values to those that are already present.
-
removeAttribute
public void removeAttribute(String name)
Description copied from interface:AttributesRemove the specified attribute from the collection.- Specified by:
removeAttributein interfaceAttributes- Parameters:
name- The name of the attribute to remove.
-
removeAttributeValue
public void removeAttributeValue(String name, String value)
Description copied from interface:AttributesRemove the specified value from the named attribute.- Specified by:
removeAttributeValuein interfaceAttributes- Parameters:
name- The name of the attribute from which to remove a value.value- The value to remove. A value will be removed only if it exactly matches this parameter.
-
removeAttributeValues
public void removeAttributeValues(String name, Set<String> values)
Description copied from interface:AttributesRemove the specified values from the named attribute.- Specified by:
removeAttributeValuesin interfaceAttributes- Parameters:
name- The name of the attribute from which to remove the values.
-
removeAttributeValues
public void removeAttributeValues(String name, String[] values)
Description copied from interface:AttributesRemove the specified values from the named attribute.- Specified by:
removeAttributeValuesin interfaceAttributes- Parameters:
name- The name of the attribute from which to remove the values.
-
removeAllAttributeValues
public void removeAllAttributeValues(String name)
Description copied from interface:AttributesRemove all values associated with the named attribute, but do not remove the attribute from the collection.- Specified by:
removeAllAttributeValuesin interfaceAttributes- Parameters:
name- The name of the attribute whose values should be removed.
-
clear
public void clear()
Description copied from interface:AttributesRemoves all attributes from the collection.- Specified by:
clearin interfaceAttributes
-
-