public class RMKey
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
RMKey.Get
This is interface is implemented by objects that can get key values themselves.
|
static interface |
RMKey.GetSet
This is interface is implemented by objects that can get/set key value themselves.
|
static class |
RMKey.KeyAccessor
KeyAccessor - enclosed class for actually getting/setting values for a given object (class) and key.
|
static interface |
RMKey.KeyMap |
static class |
RMKey.NoSetMethodException
NoSetMethodException.
|
Constructor and Description |
---|
RMKey() |
Modifier and Type | Method and Description |
---|---|
static RMKey.KeyAccessor |
getAccessor(java.lang.Object anObj,
java.lang.String aKey)
Returns the accessor object for a given object (class) and key.
|
static int |
getIntValue(java.lang.Object anObj,
java.lang.String aKey)
Returns an int value for a key.
|
static java.util.Collection<java.lang.String> |
getKeys(java.lang.Object obj) |
static java.lang.String |
getSanitizedKey(java.lang.String aKey)
Returns the given string with all invalid key characters stripped out.
|
static java.lang.String |
getStandard(java.lang.String aKey)
Returns the key in a standard format (strip is/get prefix and start with capital letter).
|
static java.lang.String |
getStringValue(java.lang.Object anObj,
java.lang.String aKey)
Returns a string value for a key.
|
static java.lang.Object |
getValue(java.lang.Object anObj,
java.lang.String aKey)
Returns a value for given object and key.
|
static <T> T |
getValue(java.lang.Object anObj,
java.lang.String aKey,
java.lang.Class<T> aClass)
Returns a value as given class, if appropriate.
|
static java.lang.Object |
getValueImpl(java.lang.Object anObj,
java.lang.String aKey)
Returns a value for given object and key.
|
static boolean |
hasKey(java.lang.Object anObj,
java.lang.String aKey)
Returns whether given object has an accessor for given key.
|
static boolean |
isKey(java.lang.String aString)
Returns whether given string is a valid key (starts with letter and only contains letters, digits,
white space and under bars).
|
static void |
setValue(java.lang.Object anObj,
java.lang.String aKey,
java.lang.Object aValue)
Sets a value for given object and key and value.
|
static void |
setValueSafe(java.lang.Object anObj,
java.lang.String aKey,
java.lang.Object aValue)
Sets the value but only prints a warning if it fails.
|
static void |
setValueSilent(java.lang.Object anObj,
java.lang.String aKey,
java.lang.Object aValue)
Tries to set value in given object, ignoring failure exceptions.
|
public static boolean isKey(@Nullable java.lang.String aString)
@Nonnull public static java.lang.String getSanitizedKey(@Nullable java.lang.String aKey)
public static java.util.Collection<java.lang.String> getKeys(java.lang.Object obj)
public static java.lang.Object getValue(java.lang.Object anObj, java.lang.String aKey)
public static java.lang.Object getValueImpl(java.lang.Object anObj, java.lang.String aKey)
public static void setValue(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue) throws java.lang.Exception
java.lang.Exception
public static void setValueSafe(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)
public static void setValueSilent(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)
public static boolean hasKey(java.lang.Object anObj, java.lang.String aKey)
public static int getIntValue(java.lang.Object anObj, java.lang.String aKey)
public static java.lang.String getStringValue(java.lang.Object anObj, java.lang.String aKey)
public static <T> T getValue(java.lang.Object anObj, java.lang.String aKey, java.lang.Class<T> aClass)
public static RMKey.KeyAccessor getAccessor(java.lang.Object anObj, java.lang.String aKey)
public static java.lang.String getStandard(@Nonnull java.lang.String aKey)