
com.basho.riak.client.convert.VClockUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riak-client Show documentation
Show all versions of riak-client Show documentation
HttpClient-based client for Riak
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.basho.riak.client.convert;
import com.basho.riak.client.cap.VClock;
import com.basho.riak.client.convert.reflect.AnnotationHelper;
/**
*
* @author Brian Roach
*/
public class VClockUtil
{
/**
* Attempts to inject vclock
as the value of the {@link RiakVClock}
* annotated field of domainObject
*
* @param
* the type of domainObject
* @param domainObject
* the object to inject the key into
* @param vclock
* the vclock to inject
* @return domainObject
with {@link RiakVClock} annotated field
* set to vclock
* @throws ConversionException
* if there is a {@link RiakVClock} annotated field but it cannot
* be set to the value of vclock
*/
public static T setVClock(T domainObject, VClock vclock) throws ConversionException {
T obj = AnnotationHelper.getInstance().setRiakVClock(domainObject, vclock);
return obj;
}
/**
* Attempts to get a vector clock from domainObject
by looking for a
* {@link RiakVClock} annotated field. If non-present it simply returns
* null
*
* @param
* the type of domainObject
* @param domainObject
* the object to search for a key
* @return either the value found on domainObject
;s
* {@link RiakVClock} field or null
*/
public static VClock getVClock(T domainObject) {
return AnnotationHelper.getInstance().getRiakVClock(domainObject);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy