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

org.jboss.weld.invokable.InvokerImpl Maven / Gradle / Ivy

package org.jboss.weld.invokable;

import java.lang.invoke.MethodHandle;

import jakarta.enterprise.inject.build.compatible.spi.InvokerInfo;
import jakarta.enterprise.invoke.Invoker;

public class InvokerImpl implements Invoker, InvokerInfo {
    private final MethodHandle mh;

    InvokerImpl(MethodHandle mh) {
        this.mh = mh;
    }

    @Override
    public R invoke(T instance, Object[] arguments) throws Exception {
        try {
            return (R) mh.invoke(instance, arguments);
        } catch (ValueCarryingException e) {
            // exception transformer may return a value by throwing a special exception
            return (R) e.getMethodReturnValue();
        } catch (Throwable e) {
            throw SneakyThrow.sneakyThrow(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy