Sunday, September 25, 2011

Using the jruby eclipse plugin to generate an interface implemention

I started using asm to put together some ruby code generation scripts for the Eclipse plugin.  This one prints out a list of method definitions and their java signatures when you select an interface in the package explorer. If you select this interface
package com.restphone.jrubyeclipse;

import org.eclipse.jface.viewers.ISelection;

public interface IJrubyFilter {
  String do_filter(ISelection s);

  Integer someOtherMethod();
}
You'll get this output:
java_signature "java.lang.String do_filter (org.eclipse.jface.viewers.ISelection a)"
def do_filter *args
end

java_signature "java.lang.Integer someOtherMethod ()"
def someOtherMethod *args
end
Checked in to github as ruby_filter_interface.rb.

No comments: