org.jruby.runtime
Class CallbackFactory

java.lang.Object
  extended byorg.jruby.runtime.CallbackFactory
Direct Known Subclasses:
CglibCallbackFactory, ReflectionCallbackFactory

public abstract class CallbackFactory
extends java.lang.Object

Helper class to build Callback method. This impements method corresponding to the signature of method most often found in the Ruby library, for methods with other signature the appropriate Callback object will need to be explicitly created.


Field Summary
static java.lang.Class[] NULL_CLASS_ARRAY
           
 
Constructor Summary
CallbackFactory()
           
 
Method Summary
static CallbackFactory createFactory()
           
abstract  Callback getBlockMethod(java.lang.Class type, java.lang.String method)
           
 Callback getFalseMethod(int arity)
           
abstract  Callback getMethod(java.lang.Class type, java.lang.String method)
          gets an instance method with no arguments.
abstract  Callback getMethod(java.lang.Class type, java.lang.String method, java.lang.Class arg1)
          gets an instance method with 1 argument.
abstract  Callback getMethod(java.lang.Class type, java.lang.String method, java.lang.Class arg1, java.lang.Class arg2)
          gets an instance method with two arguments.
 Callback getNilMethod(int arity)
           
abstract  Callback getOptMethod(java.lang.Class type, java.lang.String method)
          gets an instance method with no mandatory argument and some optional arguments.
abstract  Callback getOptMethod(java.lang.Class type, java.lang.String method, java.lang.Class arg1)
          gets an instance method with 1 mandatory argument and some optional arguments.
abstract  Callback getOptSingletonMethod(java.lang.Class type, java.lang.String method)
          gets a singleton (class) method with no mandatory argument and some optional arguments.
abstract  Callback getOptSingletonMethod(java.lang.Class type, java.lang.String method, java.lang.Class arg1)
          gets a singleton (class) method with 1 mandatory argument and some optional arguments.
abstract  Callback getOptSingletonMethod(java.lang.Class type, java.lang.String method, java.lang.Class[] args)
          gets a singleton (class) method with several mandatory argument and some optional arguments.
 Callback getSelfMethod(int arity)
           
abstract  Callback getSingletonMethod(java.lang.Class type, java.lang.String method)
          gets a singleton (class) method without arguments.
abstract  Callback getSingletonMethod(java.lang.Class type, java.lang.String method, java.lang.Class arg1)
          gets a singleton (class) method with 1 argument.
abstract  Callback getSingletonMethod(java.lang.Class type, java.lang.String method, java.lang.Class arg1, java.lang.Class arg2)
          gets a singleton (class) method with 2 arguments.
 Callback getTrueMethod(int arity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_CLASS_ARRAY

public static final java.lang.Class[] NULL_CLASS_ARRAY
Constructor Detail

CallbackFactory

public CallbackFactory()
Method Detail

getMethod

public abstract Callback getMethod(java.lang.Class type,
                                   java.lang.String method)
gets an instance method with no arguments.

Parameters:
type - java class where the method is implemented
method - name of the method
Returns:
a CallBack object corresponding to the appropriate method

getMethod

public abstract Callback getMethod(java.lang.Class type,
                                   java.lang.String method,
                                   java.lang.Class arg1)
gets an instance method with 1 argument.

Parameters:
type - java class where the method is implemented
method - name of the method
arg1 - the class of the only argument for this method
Returns:
a CallBack object corresponding to the appropriate method

getMethod

public abstract Callback getMethod(java.lang.Class type,
                                   java.lang.String method,
                                   java.lang.Class arg1,
                                   java.lang.Class arg2)
gets an instance method with two arguments.

Parameters:
type - java class where the method is implemented
method - name of the method
arg1 - the java class of the first argument for this method
arg2 - the java class of the second argument for this method
Returns:
a CallBack object corresponding to the appropriate method

getSingletonMethod

public abstract Callback getSingletonMethod(java.lang.Class type,
                                            java.lang.String method)
gets a singleton (class) method without arguments.

Parameters:
type - java class where the method is implemented
method - name of the method
Returns:
a CallBack object corresponding to the appropriate method

getSingletonMethod

public abstract Callback getSingletonMethod(java.lang.Class type,
                                            java.lang.String method,
                                            java.lang.Class arg1)
gets a singleton (class) method with 1 argument.

Parameters:
type - java class where the method is implemented
method - name of the method
arg1 - the class of the only argument for this method
Returns:
a CallBack object corresponding to the appropriate method

getSingletonMethod

public abstract Callback getSingletonMethod(java.lang.Class type,
                                            java.lang.String method,
                                            java.lang.Class arg1,
                                            java.lang.Class arg2)
gets a singleton (class) method with 2 arguments.

Parameters:
type - java class where the method is implemented
method - name of the method
Returns:
a CallBack object corresponding to the appropriate method

getBlockMethod

public abstract Callback getBlockMethod(java.lang.Class type,
                                        java.lang.String method)

getOptSingletonMethod

public abstract Callback getOptSingletonMethod(java.lang.Class type,
                                               java.lang.String method,
                                               java.lang.Class arg1)
gets a singleton (class) method with 1 mandatory argument and some optional arguments.

Parameters:
type - java class where the method is implemented
method - name of the method
arg1 - the class of the only mandatory argument for this method
Returns:
a CallBack object corresponding to the appropriate method

getOptSingletonMethod

public abstract Callback getOptSingletonMethod(java.lang.Class type,
                                               java.lang.String method,
                                               java.lang.Class[] args)
gets a singleton (class) method with several mandatory argument and some optional arguments.

Parameters:
type - java class where the method is implemented
method - name of the method
args - an array of java class of the mandatory arguments (NOTE: this must include the appropriate rest argument class (usually a RubyObject[].class))
Returns:
a CallBack object corresponding to the appropriate method

getOptSingletonMethod

public abstract Callback getOptSingletonMethod(java.lang.Class type,
                                               java.lang.String method)
gets a singleton (class) method with no mandatory argument and some optional arguments.

Parameters:
type - java class where the method is implemented
method - name of the method
Returns:
a CallBack object corresponding to the appropriate method

getOptMethod

public abstract Callback getOptMethod(java.lang.Class type,
                                      java.lang.String method)
gets an instance method with no mandatory argument and some optional arguments.

Parameters:
type - java class where the method is implemented
method - name of the method
Returns:
a CallBack object corresponding to the appropriate method

getOptMethod

public abstract Callback getOptMethod(java.lang.Class type,
                                      java.lang.String method,
                                      java.lang.Class arg1)
gets an instance method with 1 mandatory argument and some optional arguments.

Parameters:
type - java class where the method is implemented
method - name of the method
arg1 - the class of the only mandatory argument for this method
Returns:
a CallBack object corresponding to the appropriate method

getFalseMethod

public Callback getFalseMethod(int arity)

getTrueMethod

public Callback getTrueMethod(int arity)

getNilMethod

public Callback getNilMethod(int arity)

getSelfMethod

public Callback getSelfMethod(int arity)

createFactory

public static CallbackFactory createFactory()


Copyright © 2002 Jan Arne Petersen. All Rights Reserved.