Package com.inductiveautomation.rm.base
Class RMKey
- java.lang.Object
- 
- com.inductiveautomation.rm.base.RMKey
 
- 
 public class RMKey extends java.lang.ObjectThis class provides an optimized convenience for getting named values from arbitrary objects.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfaceRMKey.GetThis is interface is implemented by objects that can get key values themselves.static interfaceRMKey.GetSetThis is interface is implemented by objects that can get/set key value themselves.static classRMKey.KeyAccessorKeyAccessor - enclosed class for actually getting/setting values for a given object (class) and key.static interfaceRMKey.KeyMapstatic classRMKey.NoSetMethodExceptionNoSetMethodException.
 - 
Constructor SummaryConstructors Constructor Description RMKey()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static RMKey.KeyAccessorgetAccessor(java.lang.Object anObj, java.lang.String aKey)Returns the accessor object for a given object (class) and key.static intgetIntValue(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.StringgetSanitizedKey(java.lang.String aKey)Returns the given string with all invalid key characters stripped out.static java.lang.StringgetStandard(java.lang.String aKey)Returns the key in a standard format (strip is/get prefix and start with capital letter).static java.lang.StringgetStringValue(java.lang.Object anObj, java.lang.String aKey)Returns a string value for a key.static java.lang.ObjectgetValue(java.lang.Object anObj, java.lang.String aKey)Returns a value for given object and key.static <T> TgetValue(java.lang.Object anObj, java.lang.String aKey, java.lang.Class<T> aClass)Returns a value as given class, if appropriate.static java.lang.ObjectgetValueImpl(java.lang.Object anObj, java.lang.String aKey)Returns a value for given object and key.static booleanhasKey(java.lang.Object anObj, java.lang.String aKey)Returns whether given object has an accessor for given key.static booleanisKey(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 voidsetValue(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)Sets a value for given object and key and value.static voidsetValueSafe(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)Sets the value but only prints a warning if it fails.static voidsetValueSilent(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)Tries to set value in given object, ignoring failure exceptions.
 
- 
- 
- 
Method Detail- 
isKeypublic static boolean isKey(@Nullable 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).
 - 
getSanitizedKey@Nonnull public static java.lang.String getSanitizedKey(@Nullable java.lang.String aKey)Returns the given string with all invalid key characters stripped out. If aKey is blank, null, or contains only invalid characters, resulting string will empty and therefore invalid. Resulting string may also end up being a duplicate of another key -- there's only so much we can do for the user.
 - 
getKeyspublic static java.util.Collection<java.lang.String> getKeys(java.lang.Object obj) 
 - 
getValuepublic static java.lang.Object getValue(java.lang.Object anObj, java.lang.String aKey)Returns a value for given object and key.
 - 
getValueImplpublic static java.lang.Object getValueImpl(java.lang.Object anObj, java.lang.String aKey)Returns a value for given object and key.
 - 
setValuepublic static void setValue(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue) throws java.lang.ExceptionSets a value for given object and key and value.- Throws:
- java.lang.Exception
 
 - 
setValueSafepublic 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.
 - 
setValueSilentpublic 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.
 - 
hasKeypublic static boolean hasKey(java.lang.Object anObj, java.lang.String aKey)Returns whether given object has an accessor for given key.
 - 
getIntValuepublic static int getIntValue(java.lang.Object anObj, java.lang.String aKey)Returns an int value for a key.
 - 
getStringValuepublic static java.lang.String getStringValue(java.lang.Object anObj, java.lang.String aKey)Returns a string value for a key.
 - 
getValuepublic 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.
 - 
getAccessorpublic static RMKey.KeyAccessor getAccessor(java.lang.Object anObj, java.lang.String aKey) Returns the accessor object for a given object (class) and key.
 - 
getStandardpublic static java.lang.String getStandard(@Nonnull java.lang.String aKey)Returns the key in a standard format (strip is/get prefix and start with capital letter).
 
- 
 
-