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

net.winterly.rxjersey.server.RxInvocationHandler Maven / Gradle / Ivy

There is a newer version: 0.11.0
Show newest version
package net.winterly.rxjersey.server;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;


/**
 * Typed invocation handler that supports result conversion
 *
 * @param  Method result type
 * @param  Required type
 */
public interface RxInvocationHandler extends InvocationHandler {

    @SuppressWarnings("unchecked")
    @Override
    default Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        return convert((R) method.invoke(proxy, args));
    }

    /**
     * Converts method result into object of required type
     *
     * @param result method call result
     * @return converted value
     * @throws Throwable same as {@link InvocationHandler#invoke(Object, Method, Object[])}
     */
    T convert(R result) throws Throwable;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy