Package org.jruby.runtime.builtin

Examples of org.jruby.runtime.builtin.IRubyObject.toJava()


        IRubyObject val = value;
        if(val.dataGetStruct() instanceof JavaObject) {
            val = (IRubyObject)val.dataGetStruct();
        }
        try {
            Object convertedValue = val.toJava(field.getType());

            field.set(javaObject, convertedValue);
        } catch (IllegalAccessException iae) {
            throw getRuntime().newTypeError(
                                "illegal access on setting variable: " + iae.getMessage());
View Full Code Here


        Object[] converted = new Object[count];
       
        for (int i = 0; i < count; i++) {
            // TODO: call ruby method
            IRubyObject ith = constructor_args.aref(getRuntime().newFixnum(i));
            converted[i] = ith.toJava(parameterTypes[i]);
        }

        JavaProxyInvocationHandler handler = new JavaProxyInvocationHandler() {
            public IRubyObject getOrig() {
                return self;
View Full Code Here

                    throw runtime.newArgumentError(newArgs.length, v);
                }
                if (m.getReturnType() == void.class) {
                    return null;
                } else {
                    return result.toJava(m.getReturnType());
                }
            }
        };

        try {
View Full Code Here

        int count = (int) constructor_args.length().getLongValue();
        Object[] converted = new Object[count];
        for (int i = 0; i < count; i++) {
            // TODO: call ruby method
            IRubyObject ith = constructor_args.aref(getRuntime().newFixnum(i));
            converted[i] = ith.toJava(parameterTypes[i]);
        }

        final IRubyObject recv = this;

        JavaProxyInvocationHandler handler = new JavaProxyInvocationHandler() {
View Full Code Here

                for (int i = 0; i < length; i++) {
                    rubyArgs[i + 2] = JavaUtil.convertJavaToRuby(getRuntime(),
                            nargs[i]);
                }
                IRubyObject call_result = proc.call(getRuntime().getCurrentContext(), rubyArgs);
                Object converted_result = call_result.toJava(method.getReturnType());
                return converted_result;
            }

        };
View Full Code Here

        Object[] converted = new Object[count];
       
        for (int i = 0; i < count; i++) {
            // TODO: call ruby method
            IRubyObject ith = constructor_args.aref(getRuntime().newFixnum(i));
            converted[i] = ith.toJava(parameterTypes[i]);
        }

        JavaProxyInvocationHandler handler = new JavaProxyInvocationHandler() {
            public IRubyObject getOrig() {
                return self;
View Full Code Here

                    throw runtime.newArgumentError(newArgs.length, v);
                }
                if (m.getReturnType() == void.class) {
                    return null;
                } else {
                    return result.toJava(m.getReturnType());
                }
            }
        };

        try {
View Full Code Here

        int count = (int) constructor_args.length().getLongValue();
        Object[] converted = new Object[count];
        for (int i = 0; i < count; i++) {
            // TODO: call ruby method
            IRubyObject ith = constructor_args.aref(getRuntime().newFixnum(i));
            converted[i] = ith.toJava(parameterTypes[i]);
        }

        final IRubyObject recv = this;

        JavaProxyInvocationHandler handler = new JavaProxyInvocationHandler() {
View Full Code Here

                for (int i = 0; i < length; i++) {
                    rubyArgs[i + 2] = JavaUtil.convertJavaToRuby(getRuntime(),
                            nargs[i]);
                }
                IRubyObject call_result = proc.call(getRuntime().getCurrentContext(), rubyArgs);
                Object converted_result = call_result.toJava(method.getReturnType());
                return converted_result;
            }

        };
View Full Code Here

        return hasValue(getRuntime().getCurrentContext(), JavaUtil.convertJavaToUsableRubyObject(getRuntime(), value));
    }

    public Object get(Object key) {
        IRubyObject gotten = internalGet(JavaUtil.convertJavaToUsableRubyObject(getRuntime(), key));
        return gotten == null ? null : gotten.toJava(Object.class);
    }

    public Object put(Object key, Object value) {
        internalPut(JavaUtil.convertJavaToUsableRubyObject(getRuntime(), key), JavaUtil.convertJavaToUsableRubyObject(getRuntime(), value));
        return value;
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.