@Override public V8ArrayBuffer twin() { v8.checkThread(); checkReleased(); return (V8ArrayBuffer) super.twin(); }
/** * Returns the type of element at this given index. * * @param index The index at which to lookup the type of. * * @return The type of the element at the index. */ public int getType(final int index) { v8.checkThread(); checkReleased(); return v8.getType(v8.getV8RuntimePtr(), getHandle(), index); }
/** * Gets the type of the array. Returns a 'type' if all the elements in the array * have the same type, otherwise UNDEFINED is returned. * * @return The type of all the elements of the array, or UNDEFINED if they * are not all the same type. */ public int getType() { v8.checkThread(); checkReleased(); return v8.getArrayType(v8.getV8RuntimePtr(), getHandle()); }
@Override public String toString() { if (isReleased() || v8.isReleased()) { return "[Object released]"; } v8.checkThread(); return v8.toString(v8.getV8RuntimePtr(), getHandle()); }
/** * Returns the length of this array. * * @return The length of the array. */ public int length() { v8.checkThread(); checkReleased(); return v8.arrayGetSize(v8.getV8RuntimePtr(), getHandle()); }
@Override public int hashCode() { v8.checkThread(); checkReleased(); return v8.identityHash(v8.getV8RuntimePtr(), getHandle()); }
@Override protected void initialize(final long runtimePtr, final Object data) { v8.checkThread(); if (data == null) { super.initialize(runtimePtr, data); return; } V8ArrayData arrayData = (V8ArrayData) data; checkArrayProperties(arrayData); long handle = createTypedArray(runtimePtr, arrayData); released = false; addObjectReference(handle); }
/** * If {@link V8Value#setWeak()} has been called on this Object, this method * will return true. Otherwise it will return false. * * @return Returns true if this object has been set 'Weak', return false otherwise. */ public boolean isWeak() { v8.checkThread(); v8.checkReleased(); return v8.isWeak(v8.getV8RuntimePtr(), getHandle()); }
/** * Releases the NodeJS runtime. */ public void release() { v8.checkThread(); if (!require.isReleased()) { require.close(); } if (!v8.isReleased()) { v8.close(); } }
/** * Returns all the keys associated with this JavaScript Object. * Keys associated with the objects prototype are not returned. * * @return The keys associated with this JavaScript Object. */ public String[] getKeys() { v8.checkThread(); checkReleased(); return v8.getKeys(v8.getV8RuntimePtr(), objectHandle); }
protected V8(final String globalAlias) { super(null); released = false; v8RuntimePtr = _createIsolate(globalAlias); locker = new V8Locker(this); checkThread(); objectHandle = _getGlobalObject(v8RuntimePtr); }
/** * Gets the value at a given index as a Java Object. Primitives are boxed. * * @param index The index to get the value at. * * @return The value at the given index. */ public Object get(final int index) { v8.checkThread(); checkReleased(); return v8.arrayGet(v8.getV8RuntimePtr(), V8_OBJECT, objectHandle, index); }
protected V8Object(final V8 v8, final Object data) { super(v8); if (v8 != null) { this.v8.checkThread(); initialize(this.v8.getV8RuntimePtr(), data); } }
@Override public String toString() { if (released || v8.isReleased()) { return "[Function released]"; } return super.toString(); }
@Override protected V8Value createTwin() { v8.checkThread(); checkReleased(); return new V8TypedArray(v8); }
@Override protected void initialize(final long runtimePtr, final Object data) { long handle = v8.initNewV8Array(runtimePtr); released = false; addObjectReference(handle); }
protected void initialize(final long runtimePtr, final Object data) { long objectHandle = v8.initNewV8Object(runtimePtr); released = false; addObjectReference(objectHandle); }
@Override public String toString() { if (released || v8.isReleased()) { return "[Array released]"; } return super.toString(); }