Package org.jruby.javasupport

Examples of org.jruby.javasupport.JavaClass.javaClass()


        for (int i = interfaceCount; --i >= 0; ) {
            interfaces[i] = interfaceList.get(i);
        }
      
        try {
            return getProxyClass(recv.getRuntime(), javaClass.javaClass(), interfaces, names);
        } catch (Error e) {
            RaiseException ex = recv.getRuntime().newArgumentError("unable to create proxy class for " + javaClass.getValue() + " : " + e.getMessage());
            //e.printStackTrace();
            ex.initCause(e);
            throw ex;
View Full Code Here


            for (int i = 0; i < exceptions.length; i++) {
                if (exceptions[i] instanceof RubyClass) {
                    RubyClass rubyClass = (RubyClass)exceptions[i];
                    JavaClass javaClass = (JavaClass)rubyClass.fastGetInstanceVariable("@java_class");
                    if (javaClass != null) {
                        Class cls = javaClass.javaClass();
                        if (cls.isInstance(currentException)) {
                            return runtime.getTrue();
                        }
                    }
                }
View Full Code Here

        }
        if (catchable instanceof RubyClass && catchable.getInstanceVariables().hasInstanceVariable("@java_class")) {
            RubyClass rubyClass = (RubyClass)catchable;
            JavaClass javaClass = (JavaClass)rubyClass.fastGetInstanceVariable("@java_class");
            if (javaClass != null) {
                Class cls = javaClass.javaClass();
                if (cls.isInstance(throwable)) {
                    return true;
                }
            }
        }
View Full Code Here

        }

        RubyModule targetModule = (RubyModule)clazz;
        JavaClass javaClass = (JavaClass)self.getInstanceVariables().fastGetInstanceVariable("@java_class");
       
        Method[] javaInstanceMethods = javaClass.javaClass().getMethods();
        DynamicMethod dummyMethod = new org.jruby.internal.runtime.methods.JavaMethod(targetModule, Visibility.PUBLIC) {
            @Override
            public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) {
                // dummy bodies for default impls
                return context.getRuntime().getNil();
View Full Code Here

        for (int i = interfaceCount; --i >= 0; ) {
            interfaces[i] = interfaceList.get(i);
        }
      
        try {
            return getProxyClass(recv.getRuntime(), javaClass.javaClass(), interfaces, names);
        } catch (Error e) {
            RaiseException ex = recv.getRuntime().newArgumentError("unable to create proxy class for " + javaClass.getValue() + " : " + e.getMessage());
            //e.printStackTrace();
            ex.initCause(e);
            throw ex;
View Full Code Here

        } else if (excType instanceof RubyClass && excType.getInstanceVariables().hasInstanceVariable("@java_class")) {
            // java exception where the rescue clause has an embedded java class that could catch it
            RubyClass rubyClass = (RubyClass)excType;
            JavaClass javaClass = (JavaClass)rubyClass.getInstanceVariable("@java_class");
            if (javaClass != null) {
                Class cls = javaClass.javaClass();
                if (cls.isInstance(excObj)) return true;
            }
        }

        return false;
View Full Code Here

        } else if (catchable instanceof RubyClass && catchable.getInstanceVariables().hasInstanceVariable("@java_class")) {
            RubyClass rubyClass = (RubyClass)catchable;
            JavaClass javaClass = (JavaClass)rubyClass.getInstanceVariable("@java_class");
            if (javaClass != null) {
                Class cls = javaClass.javaClass();
                if (cls.isInstance(throwable)) {
                    return true;
                }
            }
        }
View Full Code Here

        for (int i = interfaceCount; --i >= 0; ) {
            interfaces[i] = interfaceList.get(i);
        }
      
        try {
            return getProxyClass(recv.getRuntime(), javaClass.javaClass(), interfaces, names);
        } catch (Error e) {
            RaiseException ex = recv.getRuntime().newArgumentError("unable to create proxy class for " + javaClass.getValue() + " : " + e.getMessage());
            //e.printStackTrace();
            ex.initCause(e);
            throw ex;
View Full Code Here

        }

        RubyModule targetModule = (RubyModule)clazz;
        JavaClass javaClass = (JavaClass)self.getInstanceVariables().getInstanceVariable("@java_class");
       
        Method[] javaInstanceMethods = javaClass.javaClass().getMethods();
        DynamicMethod dummyMethod = new org.jruby.internal.runtime.methods.JavaMethod(targetModule, Visibility.PUBLIC) {
            @Override
            public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) {
                // dummy bodies for default impls
                return context.runtime.getNil();
View Full Code Here

   
    @JRubyMethod(meta = true)
    public static IRubyObject new_array(ThreadContext context, IRubyObject recv, IRubyObject arg0) {
        JavaClass javaClass = (JavaClass)RuntimeHelpers.invoke(context, recv, "java_class");
        RubyClass proxyClass = (RubyClass)recv;
        Class componentType = javaClass.javaClass();
       
        // construct new array proxy (ArrayJavaProxy)
        return new ArrayJavaProxy(context.runtime, proxyClass, Array.newInstance(componentType, (int)((RubyInteger)arg0.convertToInteger()).getLongValue()));
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.