/** * Creates a List from a V8Array using a deep copy. All elements * in the V8Array are released after they are accessed. However, the root * array itself is not released. * * @param array The root of the V8Array graph. * * @return A list representing a deep copy of the V8Array rooted at 'array'. */ public static List<? super Object> toList(final V8Array array) { V8Map<Object> cache = new V8Map<Object>(); try { return toList(array, cache); } finally { cache.release(); } }
/** * Creates a Map from a V8Object using a deep copy. All elements * in the V8Object are released after they are accessed. However, the root * object itself is not released. * * @param object The root of the V8Object graph. * * @return A map representing a deep copy of the V8Object rooted at 'object'. */ public static Map<String, ? super Object> toMap(final V8Object object) { V8Map<Object> cache = new V8Map<Object>(); try { return toMap(object, cache); } finally { cache.release(); } }
/** * Creates a Map from a V8Object using a deep copy. All elements * in the V8Object are released after they are accessed. However, the root * object itself is not released. * * @param object The root of the V8Object graph. * * @return A map representing a deep copy of the V8Object rooted at 'object'. */ public static Map<String, ? super Object> toMap(final V8Object object) { V8Map<Object> cache = new V8Map<Object>(); try { return toMap(object, cache); } finally { cache.release(); } }
/** * Creates a List from a V8Array using a deep copy. All elements * in the V8Array are released after they are accessed. However, the root * array itself is not released. * * @param array The root of the V8Array graph. * * @return A list representing a deep copy of the V8Array rooted at 'array'. */ public static List<? super Object> toList(final V8Array array) { V8Map<Object> cache = new V8Map<Object>(); try { return toList(array, cache); } finally { cache.release(); } }
/** * Gets a Java Object representing the value at the given index in the V8Array. * If the value is a primitive (int, boolean or double) then a boxed instance * is returned. If the value is a String, then a String is returned. If * the value is a V8Object or V8Array, then a Map or List is returned. * * @param array The array on which to lookup the value. The array is not * released. * @param index The index whose element to lookup. * * @return A Java Object representing the value at a given index. */ public static Object getValue(final V8Array array, final int index) { V8Map<Object> cache = new V8Map<Object>(); try { return getValue(array, index, cache); } finally { cache.release(); } }
/** * Gets a Java Object representing the value with the given key in the V8Object. * If the value is a primitive (int, boolean or double) then a boxed instance * is returned. If the value is a String, then a String is returned. If * the value is a V8Object or V8Array, then a Map or List is returned. * * @param object The object on which to lookup the value. The object is not * released. * @param key The key to use to lookup the value. * * @return A Java Object representing the value at a given key. */ public static Object getValue(final V8Object object, final String key) { V8Map<Object> cache = new V8Map<Object>(); try { return getValue(object, key, cache); } finally { cache.release(); } }
/** * Gets a Java Object representing the value with the given key in the V8Object. * If the value is a primitive (int, boolean or double) then a boxed instance * is returned. If the value is a String, then a String is returned. If * the value is a V8Object or V8Array, then a Map or List is returned. * * @param object The object on which to lookup the value. The object is not * released. * @param key The key to use to lookup the value. * * @return A Java Object representing the value at a given key. */ public static Object getValue(final V8Object object, final String key) { V8Map<Object> cache = new V8Map<Object>(); try { return getValue(object, key, cache); } finally { cache.release(); } }
/** * Gets a Java Object representing the value at the given index in the V8Array. * If the value is a primitive (int, boolean or double) then a boxed instance * is returned. If the value is a String, then a String is returned. If * the value is a V8Object or V8Array, then a Map or List is returned. * * @param array The array on which to lookup the value. The array is not * released. * @param index The index whose element to lookup. * * @return A Java Object representing the value at a given index. */ public static Object getValue(final V8Array array, final int index) { V8Map<Object> cache = new V8Map<Object>(); try { return getValue(array, index, cache); } finally { cache.release(); } }