|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.basho.riak.client.convert.KeyUtil
public class KeyUtil
Static methods to get /set the annotated key from/on a domain object.
RiakKey
,
JSONConverter
Constructor Summary | |
---|---|
KeyUtil()
|
Method Summary | ||
---|---|---|
static
|
getKey(T domainObject)
Attempts to get a key from domainObject by looking for a
RiakKey annotated field. |
|
static
|
getKey(T domainObject,
String defaultKey)
Attempts to get a key from domainObject by looking for a
RiakKey annotated field. |
|
static
|
setKey(T domainObject,
String key)
Attempts to inject key as the value of the RiakKey
annotated field of domainObject |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyUtil()
Method Detail |
---|
public static <T> T setKey(T domainObject, String key) throws ConversionException
key
as the value of the RiakKey
annotated field of domainObject
T
- the type of domainObject
domainObject
- the object to inject the key intokey
- the key to inject
domainObject
with RiakKey
annotated field
set to key
ConversionException
- if there is a RiakKey
annotated field but it cannot
be set to the value of key
public static <T> String getKey(T domainObject, String defaultKey)
domainObject
by looking for a
RiakKey
annotated field. If non-present it simply returns
defaultKey
T
- the type of domainObject
domainObject
- the object to search for a keydefaultKey
- the pass through value that will get returned if no key found
on domainObject
domainObject
;s
RiakKey
field or defaultkey
public static <T> String getKey(T domainObject)
domainObject
by looking for a
RiakKey
annotated field. If non-present it simply returns
null
T
- the type of domainObject
domainObject
- the object to search for a key
domainObject
;s
RiakKey
field or null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |