public class ResourceNameKeyedMap<T>
extends com.google.common.collect.ForwardingMap<java.lang.String,T>
Map that treats all the keys as resources names. This class takes care of the key
flattening done by AAPT where '.', '-' and ':' are all replaced with '_' and will be able to find
resources with those characters in the name no matter the format. Because of that, for ResourceNameKeyedMap keys like 'my.key', 'my_key' and 'my-key' are exactly the same key.
ResourceNameKeyedMap will keep the original names given to the resources so calls to
keySet() will return the names without modifications.
| Modifier | Constructor and Description |
|---|---|
|
ResourceNameKeyedMap() |
protected |
ResourceNameKeyedMap(java.util.Map<java.lang.String,T> delegate,
java.util.Set<java.lang.String> keySet) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(java.lang.Object key) |
protected java.util.Map<java.lang.String,T> |
delegate() |
static java.lang.String |
flattenResourceName(java.lang.String resourceName)
Replicates the key flattening done by AAPT.
|
T |
get(java.lang.Object key) |
java.util.Set<java.lang.String> |
keySet() |
T |
put(java.lang.String key,
T value) |
T |
remove(java.lang.Object key) |
clear, containsValue, entrySet, equals, hashCode, isEmpty, putAll, size, standardClear, standardContainsKey, standardContainsValue, standardEquals, standardHashCode, standardIsEmpty, standardPutAll, standardRemove, standardToString, valuesprotected ResourceNameKeyedMap(@NonNull
java.util.Map<java.lang.String,T> delegate,
@NonNull
java.util.Set<java.lang.String> keySet)
public ResourceNameKeyedMap()
@NonNull
public static java.lang.String flattenResourceName(@NonNull
java.lang.String resourceName)
String returned. If none of those characters are
contained, the same String passed as input will be returned.@NonNull protected java.util.Map<java.lang.String,T> delegate()
delegate in class com.google.common.collect.ForwardingMap<java.lang.String,T>public T get(@Nullable java.lang.Object key)
public boolean containsKey(@Nullable
java.lang.Object key)
public T remove(@Nullable java.lang.Object key)