Example usage for java.lang ReflectiveOperationException ReflectiveOperationException

List of usage examples for java.lang ReflectiveOperationException ReflectiveOperationException

Introduction

In this page you can find the example usage for java.lang ReflectiveOperationException ReflectiveOperationException.

Prototype

public ReflectiveOperationException(Throwable cause) 

Source Link

Document

Constructs a new exception with the specified cause and a detail message of (cause==null ?

Usage

From source file:com.reactivetechnologies.platform.rest.AsyncEventReceiverBean.java

private Object invokeServiceMethod(SerializableHttpRequest request) throws ReflectiveOperationException {

    switch (request.getRequestMethod()) {
    case "GET":
        for (MethodInvocationHandler handler : getGetHandlers()) {
            try {
                return invokeIfMatch(handler, request);
            } catch (OperationsException e) {
                continue;
            }//from ww w . j av  a  2  s .  c  om
        }
        break;
    case "POST":
        for (MethodInvocationHandler handler : getPostHandlers()) {
            try {
                return invokeIfMatch(handler, request);
            } catch (OperationsException e) {
                continue;
            }
        }
        break;
    case "DELETE":
        for (MethodInvocationHandler handler : getDeleteHandlers()) {
            try {
                return invokeIfMatch(handler, request);
            } catch (OperationsException e) {
                continue;
            }
        }
        break;
    default:
        break;

    }
    throw new ReflectiveOperationException(new UnsupportedOperationException(request.getRequestMethod()));
}

From source file:org.apache.drill.exec.store.hive.HiveSubScan.java

public static InputSplit deserializeInputSplit(String base64, String className)
        throws IOException, ReflectiveOperationException {
    Constructor<?> constructor = Class.forName(className).getDeclaredConstructor();
    if (constructor == null) {
        throw new ReflectiveOperationException(
                "Class " + className + " does not implement a default constructor.");
    }/* ww  w. ja  v a2  s.c om*/
    constructor.setAccessible(true);
    InputSplit split = (InputSplit) constructor.newInstance();
    ByteArrayDataInput byteArrayDataInput = ByteStreams.newDataInput(Base64.decodeBase64(base64));
    split.readFields(byteArrayDataInput);
    return split;
}