Example usage for com.google.common.reflect Invokable getExceptionTypes

List of usage examples for com.google.common.reflect Invokable getExceptionTypes

Introduction

In this page you can find the example usage for com.google.common.reflect Invokable getExceptionTypes.

Prototype

public final ImmutableList<TypeToken<? extends Throwable>> getExceptionTypes() 

Source Link

Document

Returns all declared exception types of this Invokable .

Usage

From source file:org.jclouds.rest.config.SyncToAsyncHttpInvocationModule.java

public static void putInvokables(Class<?> sync, Class<?> async, Cache<Invokable<?, ?>, Invokable<?, ?>> cache) {
    for (Invokable<?, ?> invoked : methods(sync)) {
        Invokable<?, ?> delegatedMethod = method(async, invoked.getName(), getParameterTypes(invoked));
        checkArgument(/* ww w  . j a v  a  2 s. c  om*/
                delegatedMethod.getExceptionTypes().equals(invoked.getExceptionTypes())
                        || isCloseable(delegatedMethod),
                "invoked %s has different typed exceptions than target %s", invoked, delegatedMethod);
        cache.put(invoked, delegatedMethod);
    }
}

From source file:com.google.cloud.dataflow.sdk.util.ApiSurface.java

private void addExposedTypes(Invokable<?, ?> invokable, Class<?> cause) {
    addExposedTypes(invokable.getReturnType(), cause);
    for (Annotation annotation : invokable.getAnnotations()) {
        logger.debug("Adding exposed types from {}, which is an annotation on invokable {}", annotation,
                invokable);/*from  w  w w  . j av a 2s  .c o  m*/
        addExposedTypes(annotation.annotationType(), cause);
    }
    for (Parameter parameter : invokable.getParameters()) {
        logger.debug("Adding exposed types from {}, which is a parameter on invokable {}", parameter,
                invokable);
        addExposedTypes(parameter, cause);
    }
    for (TypeToken<?> exceptionType : invokable.getExceptionTypes()) {
        logger.debug("Adding exposed types from {}, which is an exception type on invokable {}", exceptionType,
                invokable);
        addExposedTypes(exceptionType, cause);
    }
}

From source file:org.apache.beam.sdk.util.ApiSurface.java

private void addExposedTypes(Invokable<?, ?> invokable, Class<?> cause) {
    addExposedTypes(invokable.getReturnType(), cause);
    for (Annotation annotation : invokable.getAnnotations()) {
        LOG.debug("Adding exposed types from {}, which is an annotation on invokable {}", annotation,
                invokable);/*ww w.ja  va 2 s .c  o  m*/
        addExposedTypes(annotation.annotationType(), cause);
    }
    for (Parameter parameter : invokable.getParameters()) {
        LOG.debug("Adding exposed types from {}, which is a parameter on invokable {}", parameter, invokable);
        addExposedTypes(parameter, cause);
    }
    for (TypeToken<?> exceptionType : invokable.getExceptionTypes()) {
        LOG.debug("Adding exposed types from {}, which is an exception type on invokable {}", exceptionType,
                invokable);
        addExposedTypes(exceptionType, cause);
    }
}