/** * 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()); }
/** * Clears any weak reference set on this V8Value and makes this a strong * reference. Strong references will not be garbage collected and this * Object must be explicitly released. * * Calling clearWeak does nothing if the object is not currently set * to weak. * * @return The receiver. */ public V8Value clearWeak() { v8.checkThread(); v8.checkReleased(); v8.v8WeakReferences.remove(getHandle()); v8.clearWeak(v8.getV8RuntimePtr(), getHandle()); return this; }
/** * Returns the 'type' of this V8Value. The available types are defined * as constants in {@link V8Value}. Only types that inherit from * {@link V8Value} can be returned here. * * @return The 'type of this V8Value. */ public int getV8Type() { if (isUndefined()) { return UNDEFINED; } v8.checkThread(); v8.checkReleased(); return v8.getType(v8.getV8RuntimePtr(), objectHandle); }
/** * Sets the V8Value as weak reference. A weak reference will eventually * be closed when no more references exist to this object. Once setWeak * is called, you should check if {@link V8Value#isReleased()} is true * before invoking any methods on this object. * * If any other references exist to this object, the object will not be * reclaimed. Even if no reference exist, V8 does not give any guarantee * the object will be closed, so this should only be used if there is no * other way to track object usage. * * @return The receiver. */ public V8Value setWeak() { v8.checkThread(); v8.checkReleased(); v8.v8WeakReferences.put(getHandle(), this); v8.setWeak(v8.getV8RuntimePtr(), getHandle()); return this; }
/** * Creates a new Java object pointing at the same V8 Value * as this. If the value is mutated (by adding new members or * changing existing ones) then both the original and twin * will be updated. Twins are .equal and .strict equals, but * not == in Java. * * Twins must be closed separately since they have their own * native resources. * * @return A new Java object pointing at the same V8 Value * as this. */ public V8Value twin() { if (isUndefined()) { return this; } v8.checkThread(); v8.checkReleased(); V8Value twin = createTwin(); v8.createTwin(this, twin); return twin; }
/** * 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()); }
/** * Clears any weak reference set on this V8Value and makes this a strong * reference. Strong references will not be garbage collected and this * Object must be explicitly released. * * Calling clearWeak does nothing if the object is not currently set * to weak. * * @return The receiver. */ public V8Value clearWeak() { v8.checkThread(); v8.checkReleased(); v8.v8WeakReferences.remove(getHandle()); v8.clearWeak(v8.getV8RuntimePtr(), getHandle()); return this; }
/** * Returns the 'type' of this V8Value. The available types are defined * as constants in {@link V8Value}. Only types that inherit from * {@link V8Value} can be returned here. * * @return The 'type of this V8Value. */ public int getV8Type() { if (isUndefined()) { return UNDEFINED; } v8.checkThread(); v8.checkReleased(); return v8.getType(v8.getV8RuntimePtr(), objectHandle); }
/** * Sets the V8Value as weak reference. A weak reference will eventually * be closed when no more references exist to this object. Once setWeak * is called, you should check if {@link V8Value#isReleased()} is true * before invoking any methods on this object. * * If any other references exist to this object, the object will not be * reclaimed. Even if no reference exist, V8 does not give any guarantee * the object will be closed, so this should only be used if there is no * other way to track object usage. * * @return The receiver. */ public V8Value setWeak() { v8.checkThread(); v8.checkReleased(); v8.v8WeakReferences.put(getHandle(), this); v8.setWeak(v8.getV8RuntimePtr(), getHandle()); return this; }
/** * Creates a new Java object pointing at the same V8 Value * as this. If the value is mutated (by adding new members or * changing existing ones) then both the original and twin * will be updated. Twins are .equal and .strict equals, but * not == in Java. * * Twins must be closed separately since they have their own * native resources. * * @return A new Java object pointing at the same V8 Value * as this. */ public V8Value twin() { if (isUndefined()) { return this; } v8.checkThread(); v8.checkReleased(); V8Value twin = createTwin(); v8.createTwin(this, twin); return twin; }
/** * Returns the backing store used for this ArrayBuffer. * * @return The backing store used for this ArrayBuffer. */ public ByteBuffer getBackingStore() { v8.checkReleased(); v8.checkThread(); return byteBuffer; }
/** * Returns the backing store used for this ArrayBuffer. * * @return The backing store used for this ArrayBuffer. */ public ByteBuffer getBackingStore() { v8.checkReleased(); v8.checkThread(); return byteBuffer; }
/** * Creates a new Java object pointing at the same V8 Value * as this. If the value is mutated (by adding new members or * changing existing ones) then both the original and twin * will be updated. Twins are .equal and .strict equals, but * not == in Java. * * Twins must be released separately since they have their own * native resources. * * @return A new Java object pointing at the same V8 Value * as this. */ public V8Value twin() { if (isUndefined()) { return this; } v8.checkThread(); v8.checkReleased(); V8Value twin = createTwin(); v8.createTwin(this, twin); return twin; }
/** * Creates a new Java object pointing at the same V8 Value * as this. If the value is mutated (by adding new members or * changing existing ones) then both the original and twin * will be updated. Twins are .equal and .strict equals, but * not == in Java. * * Twins must be released separately since they have their own * native resources. * * @return A new Java object pointing at the same V8 Value * as this. */ public V8Value twin() { if (isUndefined()) { return this; } v8.checkThread(); v8.checkReleased(); V8Value twin = createTwin(); v8.createTwin(this, twin); return twin; }