public class KeyUtil extends Object
RiakKey
,
JSONConverter
Constructor and Description |
---|
KeyUtil() |
Modifier and Type | Method and Description |
---|---|
static <T> String |
getKey(T domainObject)
Attempts to get a key from
domainObject by looking for a
RiakKey annotated field. |
static <T> String |
getKey(T domainObject,
String defaultKey)
Attempts to get a key from
domainObject by looking for a
RiakKey annotated field. |
static <T> T |
setKey(T domainObject,
String key)
|
public static <T> T setKey(T domainObject, String key) throws ConversionException
T
- the type of domainObject
domainObject
- the object to inject the key intokey
- the key to injectdomainObject
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 keydomainObject
;s
RiakKey
field or null
Copyright © 2013. All Rights Reserved.