Example usage for org.apache.commons.lang3.reflect TypeUtils containsTypeVariables

List of usage examples for org.apache.commons.lang3.reflect TypeUtils containsTypeVariables

Introduction

In this page you can find the example usage for org.apache.commons.lang3.reflect TypeUtils containsTypeVariables.

Prototype

public static boolean containsTypeVariables(final Type type) 

Source Link

Document

Learn, recursively, whether any of the type parameters associated with type are bound to variables.

Usage

From source file:therian.Operation.java

private static boolean init(Class<?> type) {
    final boolean valid;
    synchronized (type) {
        if (VALID_INFO.containsKey(type)) {
            valid = VALID_INFO.get(type).booleanValue();
        } else if (Modifier.isAbstract(type.getModifiers())) {
            valid = true;//from  w w  w .j av  a2s  . c  om
        } else {
            final Type resultType = TypeUtils.unrollVariables(TypeUtils.getTypeArguments(type, Operation.class),
                    TYPE_VARIABLE_RESULT);
            valid = !TypeUtils.containsTypeVariables(resultType);
            Validate.isTrue(valid, "%s does not fully bind type parameter %s from %s", type,
                    TYPE_VARIABLE_RESULT.getName(), Operation.class);
            VALID_INFO.put(type, Boolean.valueOf(valid));
        }
    }

    final Class<?> parent = type.getSuperclass();
    if (!Operation.class.equals(parent)) {
        init(parent.asSubclass(Operation.class));
    }
    return valid;
}