From: Charlie Squires Date: 2005-11-01T05:47:07+09:00 Subject: Re: Java Reflection in Ruby Thanks, I will give that a try. "SAKURAI Masashi" wrote in message news:200510290359.j9T3xgAQ015180@mx52.ms.so-net.ne.jp... > Hi, > >> For part of an application I'm working on I am looking to use Java >> Reflection to get method information from a .class file. > > Using yajb (http://raa.ruby-lang.org/project/yajb/), you can use Java > Reflection API from ruby (attached code). > > If you want to build a Class object from a byte array, you need to > implement the custom class loader in Java. > > Although yajb can make a subclass of any class in Java, I can not show > the implementation of java.lang.ClassLoader on yajb, because of a bug > of yajb. I'm going to fix it. > > > ###### > > require 'yajb/jbridge' > include JavaBridge > jimport 'java.io.*' > > klass = :String.jclass.getClass > puts klass.getName > > puts "=====================(field)" > klass.getDeclaredFields.each {|i| > puts i.getName > } > > puts "=====================(method)" > klass.getDeclaredMethods.each {|i| > puts i.getName > } > > -- > SAKURAI, Masashi (family, given) > m.sakurai@dream.com > >