T - Enum Typepublic class EnumResourceStringHelper<T extends java.lang.Enum<T>>
extends java.lang.Object
Enum.name().| Modifier and Type | Field and Description |
|---|---|
protected java.util.EnumMap<T,U> |
enumMap |
protected java.lang.Class<T> |
enumType |
protected java.lang.String |
LOG_TAG |
| Constructor and Description |
|---|
EnumResourceStringHelper(java.lang.Class<T> enumType,
android.content.Context context,
java.lang.String resourcePrefix,
java.lang.String resourceSuffix)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
changeContext(android.content.Context context)
Change the context used to get resource information
|
T |
getEnum(U resourceValue)
Get enum value from resource value (take the first enum value match regarding EnumClass.getEnumConstants() order)
|
java.util.List<U> |
getResource()
Get all the resource of the enum
|
java.util.List<U> |
getResource(T... enumValues)
Get resource for enumValues
|
U |
getResource(T enumValue)
Get resource for an enum
|
protected java.lang.String |
getResourceName(T value)
Get the resource name regarding to prefix, suffix, and enum.name()
|
protected void |
initMap(android.content.Context context)
Init enumMap with key as enum value and U as resource value
|
protected final java.lang.String LOG_TAG
protected java.lang.Class<T extends java.lang.Enum<T>> enumType
protected java.util.EnumMap<T extends java.lang.Enum<T>,U> enumMap
public EnumResourceStringHelper(java.lang.Class<T> enumType, android.content.Context context, java.lang.String resourcePrefix, java.lang.String resourceSuffix)
enumType - enumeration typecontext - application context needed to get resource from enum valueresourcePrefix - prefix of the enum in the resource fileresourceSuffix - suffix of the enum in the resource fileprotected void initMap(android.content.Context context)
context - context needed to get resourcepublic void changeContext(android.content.Context context)
context - to be usedprotected java.lang.String getResourceName(T value)
value - value of the enumpublic U getResource(T enumValue)
enumValue - enum valuepublic java.util.List<U> getResource(T... enumValues)
enumValues - values of enumpublic java.util.List<U> getResource()
public T getEnum(U resourceValue)
resourceValue - resource value