Examples of ArrayJavaProxy


Examples of org.jruby.java.proxies.ArrayJavaProxy

    }
   
    public static IRubyObject allocateProxy(Object javaObject, RubyClass clazz) {
        // Arrays are never stored in OPC
        if (clazz.getSuperClass() == clazz.getRuntime().getJavaSupport().getArrayProxyClass()) {
            return new ArrayJavaProxy(clazz.getRuntime(), clazz, javaObject, JavaUtil.getJavaConverter(javaObject.getClass().getComponentType()));
        }
       
        IRubyObject proxy = clazz.allocate();
        if (proxy instanceof JavaProxy) {
            ((JavaProxy)proxy).setObject(javaObject);
View Full Code Here

Examples of org.jruby.java.proxies.ArrayJavaProxy

            throw runtime.newTypeError(fromArray, runtime.getArray());
        }
       
        Object newArray = javaArrayFromRubyArrayDirect(context, fromArray);
       
        return new ArrayJavaProxy(runtime, Java.getProxyClassForObject(runtime, newArray), newArray, JavaUtil.getJavaConverter(javaClass()));
    }
View Full Code Here

Examples of org.jruby.java.proxies.ArrayJavaProxy

   
    public static IRubyObject concatArraysDirect(ThreadContext context, Object original, Object additional) {
        int oldLength = Array.getLength(original);
        int addLength = Array.getLength(additional);
       
        ArrayJavaProxy proxy = newProxiedArray(context.runtime, original.getClass().getComponentType(), oldLength + addLength);
        Object newArray = proxy.getObject();
       
        System.arraycopy(original, 0, newArray, 0, oldLength);
        System.arraycopy(additional, 0, newArray, oldLength, addLength);

        return proxy;
View Full Code Here

Examples of org.jruby.java.proxies.ArrayJavaProxy

   
    public static ArrayJavaProxy newProxiedArray(Ruby runtime, Class componentType, JavaUtil.JavaConverter converter, int size) {
        Object ary = Array.newInstance(componentType, size);
        RubyClass newProxyClass = (RubyClass)JavaClass.get(runtime, ary.getClass()).getProxyClass();

        ArrayJavaProxy proxy = new ArrayJavaProxy(runtime, newProxyClass, ary, converter);
       
        return proxy;
    }
View Full Code Here

Examples of org.jruby.java.proxies.ArrayJavaProxy

        } else {
            if (index + size > actualLength) {
                size = actualLength - index;
            }
           
            ArrayJavaProxy proxy = ArrayUtils.newProxiedArray(context.runtime, fromArray.getClass().getComponentType(), size);
            Object newArray = proxy.getObject();
            System.arraycopy(fromArray, index, newArray, 0, size);

            return proxy;
        }
    }
View Full Code Here

Examples of org.jruby.java.proxies.ArrayJavaProxy

    public static IRubyObject concatArraysDirect(ThreadContext context, Object original, IRubyObject additional) {
        Ruby runtime = context.runtime;
        int oldLength = Array.getLength(original);
        int addLength = (int)((RubyFixnum)RuntimeHelpers.invoke(context, additional, "length")).getLongValue();
       
        ArrayJavaProxy proxy = ArrayUtils.newProxiedArray(runtime, original.getClass().getComponentType(), oldLength + addLength);
        Object newArray = proxy.getObject();
       
        System.arraycopy(original, 0, newArray, 0, oldLength);

        for (int i = 0; i < addLength; i++) {
            RuntimeHelpers.invoke(context, proxy, "[]=", runtime.newFixnum(oldLength + i),
View Full Code Here

Examples of org.jruby.java.proxies.ArrayJavaProxy

    }
   
    public static IRubyObject allocateProxy(Object javaObject, RubyClass clazz) {
        // Arrays are never stored in OPC
        if (clazz.getSuperClass() == clazz.getRuntime().getJavaSupport().getArrayProxyClass()) {
            return new ArrayJavaProxy(clazz.getRuntime(), clazz, javaObject, JavaUtil.getJavaConverter(javaObject.getClass().getComponentType()));
        }
       
        IRubyObject proxy = clazz.allocate();
        if (proxy instanceof JavaProxy) {
            ((JavaProxy)proxy).setObject(javaObject);
View Full Code Here

Examples of org.jruby.java.proxies.ArrayJavaProxy

            throw runtime.newTypeError(fromArray, runtime.getArray());
        }
       
        Object newArray = javaArrayFromRubyArrayDirect(context, fromArray);
       
        return new ArrayJavaProxy(runtime, Java.getProxyClassForObject(runtime, newArray), newArray, JavaUtil.getJavaConverter(javaClass()));
    }
View Full Code Here

Examples of org.jruby.java.proxies.ArrayJavaProxy

   
    public static IRubyObject concatArraysDirect(ThreadContext context, Object original, Object additional) {
        int oldLength = Array.getLength(original);
        int addLength = Array.getLength(additional);
       
        ArrayJavaProxy proxy = newProxiedArray(context.runtime, original.getClass().getComponentType(), oldLength + addLength);
        Object newArray = proxy.getObject();
       
        System.arraycopy(original, 0, newArray, 0, oldLength);
        System.arraycopy(additional, 0, newArray, oldLength, addLength);

        return proxy;
View Full Code Here

Examples of org.jruby.java.proxies.ArrayJavaProxy

   
    public static ArrayJavaProxy newProxiedArray(Ruby runtime, Class componentType, JavaUtil.JavaConverter converter, int size) {
        Object ary = Array.newInstance(componentType, size);
        RubyClass newProxyClass = (RubyClass)JavaClass.get(runtime, ary.getClass()).getProxyClass();

        ArrayJavaProxy proxy = new ArrayJavaProxy(runtime, newProxyClass, ary, converter);
       
        return proxy;
    }
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.