public class AnnotationUtil extends Object
Modifier and Type | Method and Description |
---|---|
static <T> BinaryValue |
getBucketName(T domainObject) |
static <T> BinaryValue |
getBucketName(T domainObject,
BinaryValue defaultBucketName) |
static <T> BinaryValue |
getBucketType(T domainObject) |
static <T> BinaryValue |
getBucketType(T domainObject,
BinaryValue defaultBucketType) |
static <T> String |
getContentType(T domainObject) |
static <T> String |
getContentType(T domainObject,
String defaultContentType) |
static <T> RiakIndexes |
getIndexes(RiakIndexes container,
T domainObject)
Attempts to get all the riak indexes from a domain object by looking for
a @RiakIndexes annotated member.
|
static <T> BinaryValue |
getKey(T domainObject)
Attempts to get a key from
domainObject by looking for a
@RiakKey annotated member. |
static <T> BinaryValue |
getKey(T domainObject,
BinaryValue defaultKey)
Attempts to get a key from
domainObject by looking for a
@RiakKey annotated member. |
static <T> RiakLinks |
getLinks(RiakLinks container,
T domainObject)
Attempts to get the the Riak links from a domain object by looking for a
@RiakLinks annotated member.
|
static <T> Boolean |
getTombstone(T domainObject)
Attempts to get boolean from
domainObject by looking for a
@RiakTombstone annotated member. |
static <T> RiakUserMetadata |
getUsermetaData(RiakUserMetadata metaContainer,
T domainObject)
Attempts to get the riak user metadata from a domain object by looking
for a @RiakUsermeta annotated field or getter method.
|
static <T> VClock |
getVClock(T domainObject)
Attempts to get a vector clock from
domainObject by looking
for a @RiakVClock annotated member. |
static <T> VClock |
getVClock(T domainObject,
VClock defaultVClock) |
static <T> boolean |
hasVClockAnnotation(T domainObject) |
static <T> T |
populateIndexes(RiakIndexes indexes,
T domainObject)
Attempts to populate a domain object with the contents of the supplied
RiakIndexes by looking for a @RiakIndex annotated member
|
static <T> T |
populateLinks(RiakLinks links,
T domainObject)
Attempts to populate a domain object with riak links by looking for a
@RiakLinks annotated member.
|
static <T> T |
populateUsermeta(RiakUserMetadata usermetaData,
T domainObject)
Attempts to populate a domain object with user metadata by looking for a
@RiakUsermeta annotated member.
|
static <T> T |
setBucketName(T domainObject,
BinaryValue bucketName) |
static <T> T |
setBucketType(T domainObject,
BinaryValue bucketType) |
static <T> T |
setContentType(T domainObject,
String contentType) |
static <T> T |
setKey(T domainObject,
BinaryValue key)
Attempts to inject
key as the value of the @RiakKey
annotated member of domainObject |
static <T> T |
setLastModified(T domainObject,
Long lastModified) |
static <T> T |
setTombstone(T domainObject,
boolean isTombstone)
Attempts to inject
isTombstone as the value of the
@RiakTombstone annotated member of domainObject |
static <T> T |
setVClock(T domainObject,
VClock vclock)
Attempts to inject
vclock as the value of the
@RiakVClock annotated member of domainObject |
static <T> T |
setVTag(T domainObject,
String vtag) |
public static <T> T setKey(T domainObject, BinaryValue key) throws ConversionException
key
as the value of the @RiakKey
annotated member of domainObject
T
- the type of domainObject
domainObject
- the object to inject the key intokey
- the key to injectdomainObject
with @RiakKey annotated member
set to key
ConversionException
- if there is a @RiakKey annotated member
but it cannot be set to the value of key
public static <T> BinaryValue getKey(T domainObject, BinaryValue defaultKey)
domainObject
by looking for a
@RiakKey annotated member. 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 member or defaultkey
public static <T> BinaryValue getKey(T domainObject)
domainObject
by looking for a
@RiakKey annotated member. If non-present it simply returns
null
T
- the type of domainObject
domainObject
- the object to search for a keydomainObject
;s
@RiakKey member or null
public static <T> T setBucketName(T domainObject, BinaryValue bucketName)
public static <T> BinaryValue getBucketName(T domainObject, BinaryValue defaultBucketName)
public static <T> BinaryValue getBucketName(T domainObject)
public static <T> T setBucketType(T domainObject, BinaryValue bucketType)
public static <T> BinaryValue getBucketType(T domainObject, BinaryValue defaultBucketType)
public static <T> BinaryValue getBucketType(T domainObject)
public static <T> boolean hasVClockAnnotation(T domainObject)
public static <T> T setVClock(T domainObject, VClock vclock) throws ConversionException
vclock
as the value of the
@RiakVClock annotated member of domainObject
T
- the type of domainObject
domainObject
- the object to inject the key intovclock
- the vclock to injectdomainObject
with @RiakVClock annotated member
set to vclock
ConversionException
- if there is a @RiakVClock annotated
member but it cannot be set to the value of vclock
public static <T> VClock getVClock(T domainObject)
domainObject
by looking
for a @RiakVClock annotated member. If non-present it simply
returns null
T
- the type of domainObject
domainObject
- the object to search for a keydomainObject
;s
@RiakVClock member or null
public static <T> T setTombstone(T domainObject, boolean isTombstone) throws ConversionException
isTombstone
as the value of the
@RiakTombstone annotated member of domainObject
T
- the type of domainObject
domainObject
- the object to inject the key intoisTombstone
- the boolean to injectdomainObject
with @RiakTombstone annotated
member set to isTombstone
ConversionException
- if there is a @RiakTombstone annotated
member but it cannot be set to the value of isTombstone
public static <T> Boolean getTombstone(T domainObject)
domainObject
by looking for a
@RiakTombstone annotated member. If non-present it simply returns
null
T
- the type of domainObject
domainObject
- the object to search for a keydomainObject
's
@RiakTombstone member or null
public static <T> RiakIndexes getIndexes(RiakIndexes container, T domainObject)
If no indexes are present, an empty RiakIndexes is returned.
T
- the type of the domain objectdomainObject
- the domain objectpublic static <T> T populateIndexes(RiakIndexes indexes, T domainObject)
T
- the type of the domain objectindexes
- a populated RiakIndexes object.domainObject
- the domain objectpublic static <T> RiakLinks getLinks(RiakLinks container, T domainObject)
T
- the domain object typecontainer
- the RiakLinks containerdomainObject
- the domain objectpublic static <T> T populateLinks(RiakLinks links, T domainObject)
T
- the type of the domain objectlinks
- a collection of RiakLink objectsdomainObject
- the domain objectpublic static <T> RiakUserMetadata getUsermetaData(RiakUserMetadata metaContainer, T domainObject)
T
- the type of the domain objectmetaContainer
- the RiakUserMetadata containerdomainObject
- the domain objectpublic static <T> T populateUsermeta(RiakUserMetadata usermetaData, T domainObject)
T
- the type of the domain objectusermetaData
- a Map of user metadata.domainObject
- the domain object.public static <T> String getContentType(T domainObject)
public static <T> T setContentType(T domainObject, String contentType)
public static <T> T setVTag(T domainObject, String vtag)
public static <T> T setLastModified(T domainObject, Long lastModified)
Copyright © 2016. All rights reserved.