Package com.inductiveautomation.rm.base
Class RMKey
java.lang.Object
com.inductiveautomation.rm.base.RMKey
This class provides an optimized convenience for getting named values from arbitrary objects.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceThis is interface is implemented by objects that can get key values themselves.static interfaceThis is interface is implemented by objects that can get/set key value themselves.static classKeyAccessor - enclosed class for actually getting/setting values for a given object (class) and key.static interfacestatic classNoSetMethodException.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic RMKey.KeyAccessorgetAccessor(Object anObj, String aKey) Returns the accessor object for a given object (class) and key.static intgetIntValue(Object anObj, String aKey) Returns an int value for a key.static Collection<String>static StringgetSanitizedKey(String aKey) Returns the given string with all invalid key characters stripped out.static StringgetStandard(String aKey) Returns the key in a standard format (strip is/get prefix and start with capital letter).static StringgetStringValue(Object anObj, String aKey) Returns a string value for a key.static ObjectReturns a value for given object and key.static <T> TReturns a value as given class, if appropriate.static ObjectgetValueImpl(Object anObj, String aKey) Returns a value for given object and key.static booleanReturns whether given object has an accessor for given key.static booleanReturns whether given string is a valid key (starts with letter and only contains letters, digits, white space and under bars).static voidSets a value for given object and key and value.static voidsetValueSafe(Object anObj, String aKey, Object aValue) Sets the value but only prints a warning if it fails.static voidsetValueSilent(Object anObj, String aKey, Object aValue) Tries to set value in given object, ignoring failure exceptions.
- 
Constructor Details- 
RMKeypublic RMKey()
 
- 
- 
Method Details- 
isKeyReturns whether given string is a valid key (starts with letter and only contains letters, digits, white space and under bars).
- 
getSanitizedKeyReturns 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.
- 
getKeys
- 
getValueReturns a value for given object and key.
- 
getValueImplReturns a value for given object and key.
- 
setValueSets a value for given object and key and value.- Throws:
- Exception
 
- 
setValueSafeSets the value but only prints a warning if it fails.
- 
setValueSilentTries to set value in given object, ignoring failure exceptions.
- 
hasKeyReturns whether given object has an accessor for given key.
- 
getIntValueReturns an int value for a key.
- 
getStringValueReturns a string value for a key.
- 
getValueReturns a value as given class, if appropriate.
- 
getAccessorReturns the accessor object for a given object (class) and key.
- 
getStandardReturns the key in a standard format (strip is/get prefix and start with capital letter).
 
-