Example usage for com.google.common.base Predicate getClass

List of usage examples for com.google.common.base Predicate getClass

Introduction

In this page you can find the example usage for com.google.common.base Predicate getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:ratpack.registry.PredicateCacheability.java

public static boolean isCacheable(Predicate<?> predicate) {
    Class<?> clazz = predicate.getClass();
    if (IMPLICITLY_CACHEABLE.contains(clazz)) {
        return true;
    }/*from w  w  w.  j a  v  a 2 s .co  m*/

    try {
        return CACHEABLE_PREDICATE_CACHE.get(clazz);
    } catch (ExecutionException | UncheckedExecutionException e) {
        throw uncheck(toException(e.getCause()));
    }
}

From source file:org.kitesdk.data.spi.ConstraintsSerialization.java

/**
 * Writes out the individual {@link Predicate}.  Currently this only supports a {@code predicate} of one of the
 * following types:/*from w ww.ja  v  a  2  s. com*/
 *
 * <ul>
 *   <li>{@link org.kitesdk.data.spi.Predicates.In}</li>
 *   <li>{@link org.kitesdk.data.spi.Predicates.Exists}</li>
 *   <li>{@link com.google.common.collect.Range}</li>
 * </ul>
 * @param fieldSchema schema for the predicate's field.
 * @param predicate The predicate to serialize.
 * @param out the stream to write out the serialized predicate.
 * @throws java.io.IOException error persisting the predicate.
 */
private static void writePredicate(Schema fieldSchema, Predicate predicate, ObjectOutputStream out)
        throws IOException {
    out.writeUTF(predicate.getClass().getName());
    if (predicate instanceof Predicates.In) {
        writeInPredicate(fieldSchema, (Predicates.In) predicate, out);
    } else if (predicate instanceof Range) {
        writeRangePredicate(fieldSchema, (Range) predicate, out);
    }
}

From source file:com.eucalyptus.util.fsm.Transitions.java

private static TransitionException exceptionOnCondition(String message, Predicate p) {
    return new TransitionException(
            "Transition rejected because constraint check is false: " + message + " for class " + p.getClass());
}

From source file:org.eiichiro.bootleg.Pipeline.java

/**
 * Sets the specified {@code Predicate} to the next processing stage with 
 * the specified index and the class name of the {@code Predicate} as the 
 * stage name./*w w w.ja v a2s  . c o m*/
 * 
 * @param index The index the specified {@code Predicate} to be set.
 * @param predicate The {@code Predicate} set to the next processing stage.
 * @return This {@code Pipeline} instance.
 */
public Pipeline<T> set(int index, Predicate<T> predicate) {
    return set(index, predicate.getClass().getName(), predicate);
}

From source file:org.eiichiro.bootleg.Pipeline.java

/**
 * Sets the specified {@code Predicate} to the next processing stage with 
 * the class name of the {@code Predicate} as the stage name.
 * /* ww  w . j av a  2 s  .c  om*/
 * @param predicate The {@code Predicate} set to the next processing stage.
 * @return This {@code Pipeline} instance.
 */
public Pipeline<T> set(Predicate<T> predicate) {
    return set(stages.size(), predicate.getClass().getName(), predicate);
}