Interface Attributes
- All Known Subinterfaces:
AzAction
,AzAttributes
,AzEnvironment
,AzObligations
,AzResource
,AzSubject
- All Known Implementing Classes:
AttributesImpl
,AzActionImpl
,AzAttributesImpl
,AzEnvironmentImpl
,AzObligationsImpl
,AzResourceImpl
,AzSubjectImpl
public interface Attributes
An interface that represents a collectoin of Attributes. Unlike the Attribute interface, this interface
is not read-only. Methods are provided to update the underlying collection by adding, removing, or updating
the attributes it holds.
There is no factory method on this interface; instead, services that take Attributes parameters have
methods for generating instances of Attributes appropriate to the purpose at hand.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(String name, String[] values, boolean replace) Add the specified attribute to the attributes collection.void
addAttribute
(String name, String value, boolean replace) Add the specified attribute to the attributes collection.void
addAttribute
(String name, Set<String> values, boolean replace) Add the specified attribute to the attributes collection.void
clear()
Removes all attributes from the collection.getAttribute
(String name) Get the Attribute object for the named attribute, if present.int
Get a count of the number of Attributes (not attribute values) in this Attributes object.Get the attribute names, as a Set.getAttributeValue
(String name) Get the value of the specified attribute, if present.getAttributeValues
(String name) Get the Set of values for the specified attribute, if present.String[]
Get the set of values for the specified attribute as a String array.void
Remove all values associated with the named attribute, but do not remove the attribute from the collection.void
removeAttribute
(String name) Remove the specified attribute from the collection.void
removeAttributeValue
(String name, String value) Remove the specified value from the named attribute.void
removeAttributeValues
(String name, String[] values) Remove the specified values from the named attribute.void
removeAttributeValues
(String name, Set<String> values) Remove the specified values from the named attribute.
-
Method Details
-
getAttributeCount
int getAttributeCount()Get a count of the number of Attributes (not attribute values) in this Attributes object.- Returns:
- The attribute count.
-
getAttributeNames
Get the attribute names, as a Set. This set is read-only; updating it will not change the underlying attributes collection.- Returns:
- The attribute names Set.
-
getAttribute
Get the Attribute object for the named attribute, if present.- Parameters:
name
- The name of the Attribute to get.- Returns:
- The Attribute, or null if an attribute by that name is not present.
-
getAttributeValue
Get 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.- 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
Get the Set of values for the specified attribute, if present.- 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
Get the set of values for the specified attribute as a String array.- 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
Add 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.- 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
Add 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.- 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.value
- The Set of values to add.
-
addAttribute
Add 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.- 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.value
- The array of values to add.
-
removeAttribute
Remove the specified attribute from the collection.- Parameters:
name
- The name of the attribute to remove.
-
removeAttributeValue
Remove the specified value from the named attribute.- 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
Remove the specified values from the named attribute.- Parameters:
name
- The name of the attribute from which to remove the values.value
- The Set of values to remove. Only values that exactly match values in this Set will be removed.
-
removeAttributeValues
Remove the specified values from the named attribute.- Parameters:
name
- The name of the attribute from which to remove the values.value
- The array of values to remove. Only values that exactly match values in this array will be removed.
-
removeAllAttributeValues
Remove all values associated with the named attribute, but do not remove the attribute from the collection.- Parameters:
name
- The name of the attribute whose values should be removed.
-
clear
void clear()Removes all attributes from the collection.
-