|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.javasupport.RubyProxyFactory
A RubyProxyFactory dispenses RubyProxy objects, which provide a convenient, dynamic wrapper around Ruby objects. A RubyProxyFactory must be initialized with a Ruby instance, presumably one which has been loaded with classes which you want to instantiate from Java, and an object implementing the RubyToJavaClassMap interface, which provides a way to map between Ruby and Java classes while converting arguments to and from method calls.
The API is composed of three primary method calls: newProxyObject, which creates a new RubyObject and returns a wrapper around it, getProxyForObject, which takes an existing RubyObject and returns a wrapper around it, and getProxyForGlobal, which finds the RubyObject stored in a Ruby global variable ($variable) and returns a wrapper around it.
Constructor Summary | |
RubyProxyFactory(Ruby ruby,
RubyToJavaClassMap classMap)
|
Method Summary | |
IRubyObject[] |
convertJavaToRuby(java.lang.Object[] obj)
Helper methods for RubyConversion (used by RubyInvocationHandler) |
java.lang.Object |
convertRubyToJava(IRubyObject obj,
java.lang.Class type)
|
protected java.lang.Class |
getJavaClassForRubyClass(RubyClass rubyClass)
|
RubyProxy |
getProxyForGlobal(java.lang.String globalVar)
|
RubyProxy |
getProxyForGlobal(java.lang.String globalVar,
java.lang.Class javaInterface)
|
RubyProxy |
getProxyForObject(IRubyObject obj)
Create a wrapper around the specified RubyObject. |
RubyProxy |
getProxyForObject(IRubyObject obj,
java.lang.Class javaInterface)
|
Ruby |
getRuby()
|
protected RubyClass |
getRubyClassForJavaClass(java.lang.Class javaClass)
Helper methods for RubyToJavaClassMap |
RubyProxy |
newProxyObject(java.lang.Class javaInterface)
Create a new instance of the RubyClass corresponding to the specified Java interface. |
RubyProxy |
newProxyObject(java.lang.Class javaInterface,
java.lang.Object[] args)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RubyProxyFactory(Ruby ruby, RubyToJavaClassMap classMap)
Method Detail |
public Ruby getRuby()
public RubyProxy newProxyObject(java.lang.Class javaInterface)
public RubyProxy newProxyObject(java.lang.Class javaInterface, java.lang.Object[] args)
public RubyProxy getProxyForGlobal(java.lang.String globalVar)
public RubyProxy getProxyForGlobal(java.lang.String globalVar, java.lang.Class javaInterface)
public RubyProxy getProxyForObject(IRubyObject obj)
public RubyProxy getProxyForObject(IRubyObject obj, java.lang.Class javaInterface)
protected RubyClass getRubyClassForJavaClass(java.lang.Class javaClass)
protected java.lang.Class getJavaClassForRubyClass(RubyClass rubyClass)
public IRubyObject[] convertJavaToRuby(java.lang.Object[] obj)
public java.lang.Object convertRubyToJava(IRubyObject obj, java.lang.Class type)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |