All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.basho.riak.client.convert.TombstoneUtil Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
/*
 * 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 TombstoneUtil
{
    /**
     * Attempts to inject isTombstone as the value of the {@link RiakTombstone}
     * annotated field of domainObject
     * 
     * @param 
     *            the type of domainObject
     * @param domainObject
     *            the object to inject the key into
     * @param isTombstone
     *            the boolean to inject
     * @return domainObject with {@link RiakTombstone} annotated field
     *         set to isTombstone
     * @throws ConversionException
     *             if there is a {@link Riaktombstone} annotated field but it cannot
     *             be set to the value of isTombstone
     */
    public static  T setTombstone(T domainObject, boolean isTombstone) throws ConversionException {
        T obj = AnnotationHelper.getInstance().setRiakTombstone(domainObject, isTombstone);
        return obj;
    }
    
    /**
     * Attempts to get boolean from domainObject by looking for a
     * {@link RiakTombstone} 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 RiakTombstone} field or null
     */
    public static  Boolean getTombstone(T domainObject) {
        return AnnotationHelper.getInstance().getRiakTombstone(domainObject);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy