public class KeyAttributesMap
extends java.lang.Object
implements java.security.spec.AlgorithmParameterSpec, java.security.spec.KeySpec
KeyAttributesMap defines key attributes to be used during key-related operations.
KeyAttributesMap implements AlgorithmParameterSpec for use with Services that
accept an AlgorithmParameterSpec.
AlgorithmParameterSpec| Constructor and Description |
|---|
KeyAttributesMap()
Constructs an empty
KeyAttributesMap containing no key attributes or values. |
KeyAttributesMap(KeyAttributePermissiveProfile permissiveProfile)
Constructs a new
KeyAttributesMap using the key attributes and permissive values
as specified in KeyAttributePermissiveProfile. |
KeyAttributesMap(KeyAttributesMap keyAttributesMap)
Constructs a new
KeyAttributesMap with the same key attributes and values as the
specified KeyAttributesMap. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(KeyAttribute keyAttribute)
Returns
true if this map contains a mapping for the specified key attribute. |
java.util.Set<java.util.Map.Entry<KeyAttribute,java.lang.Object>> |
entrySet()
Returns a
Set view of the mappings contained in this map. |
java.lang.Object |
get(KeyAttribute keyAttribute)
Returns the value to which the specified key attribute is mapped, or
null if
this map contains no mapping for the key attribute. |
java.lang.Object |
getOrDefault(KeyAttribute keyAttribute,
java.lang.Object defaultValue)
Returns the value to which the specified key attribute is mapped, or
defaultValue
if this map contains no mapping for the key attribute. |
java.util.Set<KeyAttribute> |
keySet()
Returns a
Set view of the key attributes contained in this map. |
java.lang.Object |
put(KeyAttribute keyAttribute,
java.lang.Object value)
Associates the specified value with the specified key attribute in this map.
|
void |
putAll(KeyAttributesMap keyAttributesMap)
Copies all mappings from the specified map to this map.
|
java.lang.Object |
remove(KeyAttribute keyAttribute)
Removes the mapping for the specified key attribute from this map if present.
|
boolean |
remove(KeyAttribute keyAttribute,
java.lang.Object value)
Removes the entry for the specified key attribute only if it is currently mapped to the
specified value.
|
public KeyAttributesMap()
KeyAttributesMap containing no key attributes or values.public KeyAttributesMap(KeyAttributesMap keyAttributesMap) throws AddAttributeException
KeyAttributesMap with the same key attributes and values as the
specified KeyAttributesMap.keyAttributesMap - The KeyAttributesMap whose key attributes and values are
to be placed in this KeyAttributesMap.java.security.InvalidParameterException - If the specified object is null.AddAttributeException - If there was a problem adding attributes from
keyAttributesMap.public KeyAttributesMap(KeyAttributePermissiveProfile permissiveProfile)
KeyAttributesMap using the key attributes and permissive values
as specified in KeyAttributePermissiveProfile.permissiveProfile - A specific KeyAttributePermissiveProfile profile whose key
attributes and permissive values will be used to populate a new instance of
KeyAttributesMap.public boolean containsKey(KeyAttribute keyAttribute)
true if this map contains a mapping for the specified key attribute.keyAttribute - The key attribute whose presence in this map is to be tested.true if this map contains a mapping for the specified key attribute.public java.util.Set<java.util.Map.Entry<KeyAttribute,java.lang.Object>> entrySet()
Set view of the mappings contained in this map.
The set is backed by the map, so changes to the map are reflected in the set, and
vice-versa. If the map is modified while an iteration over the set is in progress (except
through the iterator's own remove operation, or through the setValue
operation on a map entry returned by the iterator) the results of the iteration are
undefined.
Set view of the mappings contained in this map.public java.lang.Object get(KeyAttribute keyAttribute)
null if
this map contains no mapping for the key attribute.keyAttribute - Key attribute whose associated value is to be returned.null if
this map contains no mapping for the key attribute.java.security.InvalidParameterException - If the specified key attribute is null.public java.lang.Object getOrDefault(KeyAttribute keyAttribute, java.lang.Object defaultValue)
defaultValue
if this map contains no mapping for the key attribute.keyAttribute - Key attribute whose associated value is to be returned.defaultValue - The default mapping of the key attribute.defaultValue
if this map contains no mapping for the key attribute.java.security.InvalidParameterException - If the specified key attribute is null.public java.util.Set<KeyAttribute> keySet()
Set view of the key attributes contained in this map.
The set is backed by the map, so changes to the map are reflected in the set, and
vice-versa. If the map is modified while an iteration over the set is in progress (except
through the iterator's own remove operation), the results of the iteration are
undefined.
Set view of the key attributes contained in this map.public java.lang.Object put(KeyAttribute keyAttribute, java.lang.Object value) throws AddAttributeException
If the map previously contained a mapping for the key attribute, the old value is replaced.
keyAttribute - Key attribute with which the specified value is to be associated.value - Value to be associated with the specified key attribute.null if there
was no mapping for key attribute.java.security.InvalidParameterException - If the specified key attribute or value is null
.AddAttributeException - If there was a problem adding the specified attribute.public void putAll(KeyAttributesMap keyAttributesMap) throws AddAttributeException
These mappings will replace any mappings that this map had for any of the key attributes currently in the specified map.
keyAttributesMap - Key attribute mappings to be stored in this map.java.security.InvalidParameterException - If the specified map is null or it contains
null key attributes or values.AddAttributeException - If there was a problem adding attributes from
keyAttributesMap.public java.lang.Object remove(KeyAttribute keyAttribute) throws java.lang.NullPointerException
keyAttribute - Key attribute whose mapping is to be removed.null if there was no
mapping for keyAttribute.java.security.InvalidParameterException - If the specified key attribute is null.java.lang.NullPointerExceptionpublic boolean remove(KeyAttribute keyAttribute, java.lang.Object value)
keyAttribute - Key attribute with which the specified value is associated.value - Value expected to be associated with the specified key attribute.java.security.InvalidParameterException - If the specified key attribute or value is null
.