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

org.kohsuke.stapler.jelly.jruby.RubyMethodRef Maven / Gradle / Ivy

There is a newer version: 1.263
Show newest version
package org.kohsuke.stapler.jelly.jruby;

import org.jruby.RubyModule;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.javasupport.Java;
import org.jruby.runtime.builtin.IRubyObject;
import org.kohsuke.stapler.lang.MethodRef;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;

/**
 * @author Kohsuke Kawaguchi
 */
public class RubyMethodRef extends MethodRef {
    private final RubyModule klass;
    private final DynamicMethod method;


    public RubyMethodRef(RubyModule klass, DynamicMethod method) {
        this.klass = klass;
        this.method = method;
    }

    @Override
    public  T getAnnotation(Class type) {
        // TODO: what's the equivalent in JRuby?
        return null;
    }

    @Override
    public Object invoke(Object _this, Object... args) throws InvocationTargetException, IllegalAccessException {
        IRubyObject[] argList = new IRubyObject[args.length];
        for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy