Package org.wildfly.security.authz
Class MapAttributes
java.lang.Object
org.wildfly.security.authz.MapAttributes
- All Implemented Interfaces:
Attributes
A map-backed attributes collection.
- Author:
- David M. Lloyd
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.wildfly.security.authz.Attributes
Attributes.Entry, Attributes.SetEntry -
Field Summary
Fields inherited from interface org.wildfly.security.authz.Attributes
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an instance using a hash map for backing store.MapAttributes(Map<String, ? extends Collection<String>> original) Construct a new instance copying mappings from an original map.MapAttributes(Attributes original) Construct a new instance copying mappings from an original attributes collection. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a mapping for the given key at the given position.voidAdd a value before the first mapping for the given key.voidAdd a value after the last mapping for the given key.voidclear()Clear this collection, resetting its size to zero.booleancontainsKey(String key) Determine if the given key has values in this collection.booleancontainsValue(String key, String value) Determine if the given key has a mapping for the given value in this collection.copyAndRemove(String key) Remove all values for the given key from this collection, copying the values into a list which is returned.copyAndReplace(String key, Collection<String> values) Replace the mapping for the given key with the values copied from the given collection.entries()Get the entry collection.Get the collection of values for the given key.Get the mapping for the given key at the given position.Get the first value mapped to the given key.Get the last value mapped to the given key.intGet the index of the first occurrence of the given value at the given key, if any.booleanisEmpty()Determine if this collection is empty.keySet()Get a set comprised of all the keys in this collection.intlastIndexOf(String key, String value) Get the index of the last occurrence of the given value at the given key, if any.booleanRemove all values for the given key from this collection.Remove and return the mapping for the given key at the given position.booleanRemove the mapping for the given key at the given position if it matches the given existing value.booleanRemove the all occurrences of the given value under the given key, if any.removeFirst(String key) Remove the first value mapped to the given key.booleanremoveFirst(String key, String value) Remove the first occurrence of the given value under the given key, if any.removeLast(String key) Remove the last value mapped to the given key.booleanremoveLast(String key, String value) Remove the last occurrence of the given value under the given key, if any.voidremoveRange(String key, int from, int to) Remove all the values for the given key between thefromindex (inclusive) and thetoindex (exclusive).Modify the mapping for the given key at the given position.booleanConditionally set a specific value of a given key to a new value, if the existing value matches theexpectparameter.intsize()Get the number of keys in this attribute collection.intGet the number of values mapped to the given key.values()Get all the values of all the keys in this collection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.security.authz.Attributes
addAll, addAll, asReadOnly
-
Constructor Details
-
MapAttributes
public MapAttributes()Construct an instance using a hash map for backing store. -
MapAttributes
Construct a new instance copying mappings from an original map.- Parameters:
original- the original map
-
MapAttributes
Construct a new instance copying mappings from an original attributes collection.- Parameters:
original- the original collection
-
-
Method Details
-
keySet
Description copied from interface:AttributesGet a set comprised of all the keys in this collection. The returned set can be used to modify this attributes collection.- Specified by:
keySetin interfaceAttributes- Returns:
- the set of all keys (not
null)
-
values
Description copied from interface:AttributesGet all the values of all the keys in this collection. The returned collection can be used to modify this attributes collection.- Specified by:
valuesin interfaceAttributes- Returns:
- the collection of all values (not
null)
-
entries
Description copied from interface:AttributesGet the entry collection. Changes to the entry collection will modify this attribute collection, if it is writable. The returned entries will remain up to date with the state of this collection.- Specified by:
entriesin interfaceAttributes- Returns:
- the entry collection
-
size
Description copied from interface:AttributesGet the number of values mapped to the given key.- Specified by:
sizein interfaceAttributes- Parameters:
key- the key- Returns:
- the number of mapped values
-
remove
Description copied from interface:AttributesRemove all values for the given key from this collection.- Specified by:
removein interfaceAttributes- Parameters:
key- the key- Returns:
trueif the key was found,falseotherwise
-
add
Description copied from interface:AttributesAdd a mapping for the given key at the given position.- Specified by:
addin interfaceAttributes- Parameters:
key- the keyidx- the indexvalue- the mapping value
-
get
Description copied from interface:AttributesGet the mapping for the given key at the given position.- Specified by:
getin interfaceAttributes- Parameters:
key- the keyidx- the index- Returns:
- the mapping value
-
set
Description copied from interface:AttributesModify the mapping for the given key at the given position.- Specified by:
setin interfaceAttributes- Parameters:
key- the keyidx- the indexvalue- the mapping value- Returns:
- the previous mapping value
-
remove
Description copied from interface:AttributesRemove and return the mapping for the given key at the given position. All later entries for that key are shifted up to fill in the gap left by the removed element.- Specified by:
removein interfaceAttributes- Parameters:
key- the keyidx- the index- Returns:
- the previous mapping value
-
copyAndRemove
Description copied from interface:AttributesRemove all values for the given key from this collection, copying the values into a list which is returned.- Specified by:
copyAndRemovein interfaceAttributes- Parameters:
key- the key- Returns:
- the values as a list (not
null)
-
copyAndReplace
Description copied from interface:AttributesReplace the mapping for the given key with the values copied from the given collection.- Specified by:
copyAndReplacein interfaceAttributes- Parameters:
key- the keyvalues- the new values- Returns:
- a list containing the previously mapped values
-
containsKey
Description copied from interface:AttributesDetermine if the given key has values in this collection.- Specified by:
containsKeyin interfaceAttributes- Parameters:
key- the key- Returns:
trueif the key has values,falseotherwise
-
containsValue
Description copied from interface:AttributesDetermine if the given key has a mapping for the given value in this collection.- Specified by:
containsValuein interfaceAttributes- Parameters:
key- the keyvalue- the value- Returns:
trueif the key has a mapping to the given value,falseotherwise
-
removeRange
Description copied from interface:AttributesRemove all the values for the given key between thefromindex (inclusive) and thetoindex (exclusive).- Specified by:
removeRangein interfaceAttributes- Parameters:
key- the keyfrom- the start index (inclusive)to- the end index (exclusive)
-
indexOf
Description copied from interface:AttributesGet the index of the first occurrence of the given value at the given key, if any.- Specified by:
indexOfin interfaceAttributes- Parameters:
key- the keyvalue- the value- Returns:
- the index, or -1 if the value was not found at the given key
-
lastIndexOf
Description copied from interface:AttributesGet the index of the last occurrence of the given value at the given key, if any.- Specified by:
lastIndexOfin interfaceAttributes- Parameters:
key- the keyvalue- the value- Returns:
- the index, or -1 if the value was not found at the given key
-
set
Description copied from interface:AttributesConditionally set a specific value of a given key to a new value, if the existing value matches theexpectparameter.- Specified by:
setin interfaceAttributes- Parameters:
key- the keyidx- the indexexpect- the expected valueupdate- the value to set- Returns:
trueif the actual value matched the expected value and was updated,falseotherwise
-
getFirst
Description copied from interface:AttributesGet the first value mapped to the given key.- Specified by:
getFirstin interfaceAttributes- Parameters:
key- the key- Returns:
- the value
-
getLast
Description copied from interface:AttributesGet the last value mapped to the given key.- Specified by:
getLastin interfaceAttributes- Parameters:
key- the key- Returns:
- the value
-
addFirst
Description copied from interface:AttributesAdd a value before the first mapping for the given key.- Specified by:
addFirstin interfaceAttributes- Parameters:
key- the keyvalue- the value
-
addLast
Description copied from interface:AttributesAdd a value after the last mapping for the given key.- Specified by:
addLastin interfaceAttributes- Parameters:
key- the keyvalue- the value
-
removeFirst
Description copied from interface:AttributesRemove the first occurrence of the given value under the given key, if any.- Specified by:
removeFirstin interfaceAttributes- Parameters:
key- the keyvalue- the value to remove- Returns:
trueif the value was found and removed,falseotherwise
-
removeLast
Description copied from interface:AttributesRemove the last occurrence of the given value under the given key, if any.- Specified by:
removeLastin interfaceAttributes- Parameters:
key- the keyvalue- the value to remove- Returns:
trueif the value was found and removed,falseotherwise
-
removeFirst
Description copied from interface:AttributesRemove the first value mapped to the given key.- Specified by:
removeFirstin interfaceAttributes- Parameters:
key- the key- Returns:
- the value
-
removeLast
Description copied from interface:AttributesRemove the last value mapped to the given key.- Specified by:
removeLastin interfaceAttributes- Parameters:
key- the key- Returns:
- the value
-
remove
Description copied from interface:AttributesRemove the mapping for the given key at the given position if it matches the given existing value. All later entries for that key are shifted up to fill in the gap left by the removed element.- Specified by:
removein interfaceAttributes- Parameters:
key- the keyidx- the indexvalue- the expected previous mapping value- Returns:
trueif the value matched and was removed,falseotherwise
-
removeAll
Description copied from interface:AttributesRemove the all occurrences of the given value under the given key, if any.- Specified by:
removeAllin interfaceAttributes- Parameters:
key- the keyvalue- the value to remove- Returns:
trueif the value was found and removed,falseotherwise
-
get
Description copied from interface:AttributesGet the collection of values for the given key. The result may implementAttributes.SetEntryif the values are distinct (for example, a role or group set).- Specified by:
getin interfaceAttributes- Parameters:
key- the attribute name- Returns:
- the (possibly empty) attribute value collection
-
size
public int size()Description copied from interface:AttributesGet the number of keys in this attribute collection.- Specified by:
sizein interfaceAttributes- Returns:
- the number of keys
-
isEmpty
public boolean isEmpty()Description copied from interface:AttributesDetermine if this collection is empty.- Specified by:
isEmptyin interfaceAttributes- Returns:
trueif the collection is empty,falseotherwise
-
clear
public void clear()Description copied from interface:AttributesClear this collection, resetting its size to zero.- Specified by:
clearin interfaceAttributes
-