org.jruby.javasupport.proxy
Class JavaProxyClass

java.lang.Object
  extended by org.jruby.RubyObject
      extended by org.jruby.javasupport.proxy.JavaProxyReflectionObject
          extended by org.jruby.javasupport.proxy.JavaProxyClass
All Implemented Interfaces:
java.lang.Cloneable, IRubyObject

public class JavaProxyClass
extends JavaProxyReflectionObject

Generalized proxy for classes and interfaces. API looks a lot like java.lang.reflect.Proxy, except that you can specify a super class in addition to a set of interfaces. The main implication for users of this class is to handle the case where a proxy method overrides an existing method, because in this case the invocation handler should "default" to calling the super implementation {JavaProxyMethod.invokeSuper}.

Author:
krab@trifork.com
See Also:
Proxy

Nested Class Summary
static class JavaProxyClass.ProxyMethodImpl
           
 
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Finalizer
 
Field Summary
 
Fields inherited from class org.jruby.RubyObject
instanceVariables, isTrue, metaClass, NEVER, OBJECT_ALLOCATOR
 
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
 
Method Summary
 RubyArray constructors()
           
static RubyClass createJavaProxyClassClass(Ruby runtime, RubyModule javaModule)
           
static void createJavaProxyModule(Ruby runtime)
           
static RubyObject get_with_class(IRubyObject recv, RubyClass clazz)
           
static RubyObject get(IRubyObject recv, JavaClass type)
           
 JavaProxyConstructor getConstructor(java.lang.Class[] args)
           
 JavaProxyConstructor[] getConstructors()
           
 java.lang.Class[] getInterfaces()
           
 JavaProxyMethod getMethod(java.lang.String name, java.lang.Class[] parameterTypes)
           
 JavaProxyMethod[] getMethods()
           
static JavaProxyClass getProxyClass(Ruby runtime, java.lang.Class superClass, java.lang.Class[] interfaces)
           
static JavaProxyClass getProxyClass(Ruby runtime, java.lang.Class superClass, java.lang.Class[] interfaces, java.util.Set names)
           
 java.lang.Class getSuperclass()
           
 java.lang.Object getValue()
           
 RubyArray interfaces()
           
 RubyArray methods()
           
 java.lang.String nameOnInspection()
           
static java.lang.Object newProxyInstance(Ruby runtime, java.lang.Class superClass, java.lang.Class[] interfaces, java.lang.Class[] constructorParameters, java.lang.Object[] constructorArgs, JavaProxyInvocationHandler handler)
           
 RubyObject superclass()
           
 
Methods inherited from class org.jruby.javasupport.proxy.JavaProxyReflectionObject
aref, aset, buildRubyArray, buildRubyArray, equal, equals, hash, hashCode, is_java_proxy, java_class, java_type, length, registerRubyMethods, same, to_s, toString
 
Methods inherited from class org.jruby.RubyObject
addFinalizer, anyToString, asString, asSymbol, attachToObjectSpace, callInit, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethodMissing, callMethodMissing, callSuper, checkArrayType, checkFrozen, checkStringType, compilerCallMethod, compilerCallMethodWithIndex, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToString, convertToType, convertToType, convertToType, convertToTypeWithCheck, createObjectClass, dataGetStruct, dataWrapStruct, display, doClone, dup, eql, eqlInternal, equalInternal, evalSimple, evalUnder, evalWithBinding, extend, freeze, frozen, getInstanceVariable, getInstanceVariables, getInstanceVariablesSnapshot, getJavaClass, getMetaClass, getNativeTypeIndex, getRuntime, getSingletonClass, getSingletonClassClone, getType, id_deprecated, id, infectBy, inherited, initCopy, initialize_copy, initialize, inspect, instance_eval, instance_exec, instance_of, instance_variable_get, instance_variable_set, instance_variables, instanceVariableNames, isFalse, isFrozen, isImmediate, isKindOf, isNil, isSingleton, isTaint, isTrue, kind_of, makeMetaClass, match, method, methods, nil_p, obj_equal, private_methods, protected_methods, public_methods, puts, rbClone, remove_instance_variable, removeFinalizers, removeInstanceVariable, respond_to, respondsTo, safeGetInstanceVariables, safeHasInstanceVariables, send, setFrozen, setInstanceVariable, setInstanceVariable, setInstanceVariables, setMetaClass, setTaint, singleton_methods, specificEval, taint, tainted, testFrozen, trueFalseNil, trueFalseNil, type_deprecated, type, untaint
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getValue

public java.lang.Object getValue()

getProxyClass

public static JavaProxyClass getProxyClass(Ruby runtime,
                                           java.lang.Class superClass,
                                           java.lang.Class[] interfaces,
                                           java.util.Set names)
                                    throws java.lang.reflect.InvocationTargetException
Throws:
java.lang.reflect.InvocationTargetException

getProxyClass

public static JavaProxyClass getProxyClass(Ruby runtime,
                                           java.lang.Class superClass,
                                           java.lang.Class[] interfaces)
                                    throws java.lang.reflect.InvocationTargetException
Throws:
java.lang.reflect.InvocationTargetException

newProxyInstance

public static java.lang.Object newProxyInstance(Ruby runtime,
                                                java.lang.Class superClass,
                                                java.lang.Class[] interfaces,
                                                java.lang.Class[] constructorParameters,
                                                java.lang.Object[] constructorArgs,
                                                JavaProxyInvocationHandler handler)
                                         throws java.lang.IllegalArgumentException,
                                                java.lang.InstantiationException,
                                                java.lang.IllegalAccessException,
                                                java.lang.reflect.InvocationTargetException,
                                                java.lang.SecurityException,
                                                java.lang.NoSuchMethodException
Throws:
java.lang.IllegalArgumentException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.SecurityException
java.lang.NoSuchMethodException

getSuperclass

public java.lang.Class getSuperclass()

getInterfaces

public java.lang.Class[] getInterfaces()

getConstructors

public JavaProxyConstructor[] getConstructors()

getConstructor

public JavaProxyConstructor getConstructor(java.lang.Class[] args)
                                    throws java.lang.SecurityException,
                                           java.lang.NoSuchMethodException
Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException

getMethods

public JavaProxyMethod[] getMethods()

getMethod

public JavaProxyMethod getMethod(java.lang.String name,
                                 java.lang.Class[] parameterTypes)

createJavaProxyClassClass

public static RubyClass createJavaProxyClassClass(Ruby runtime,
                                                  RubyModule javaModule)

get

public static RubyObject get(IRubyObject recv,
                             JavaClass type)

get_with_class

public static RubyObject get_with_class(IRubyObject recv,
                                        RubyClass clazz)

superclass

public RubyObject superclass()

methods

public RubyArray methods()

interfaces

public RubyArray interfaces()

constructors

public RubyArray constructors()

createJavaProxyModule

public static void createJavaProxyModule(Ruby runtime)

nameOnInspection

public java.lang.String nameOnInspection()


Copyright © 2002-2007 JRuby Team. All Rights Reserved.