Java Code Examples for org.mozilla.javascript.ScriptRuntime#wrapInt()

The following examples show how to use org.mozilla.javascript.ScriptRuntime#wrapInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeArrayBuffer.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected Object getInstanceIdValue(int id)
{
    if (id == Id_byteLength) {
        return ScriptRuntime.wrapInt(buffer.length);
    }
    return super.getInstanceIdValue(id);
}
 
Example 2
Source File: NativeTypedArrayView.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected Object getInstanceIdValue(int id)
{
    switch (id) {
    case Id_length:
        return ScriptRuntime.wrapInt(length);
    case Id_BYTES_PER_ELEMENT:
        return ScriptRuntime.wrapInt(getBytesPerElement());
    default:
        return super.getInstanceIdValue(id);
    }
}
 
Example 3
Source File: NativeArrayBufferView.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected Object getInstanceIdValue(int id)
{
    switch (id) {
    case Id_buffer:
        return arrayBuffer;
    case Id_byteOffset:
        return ScriptRuntime.wrapInt(offset);
    case Id_byteLength:
        return ScriptRuntime.wrapInt(byteLength);
    default:
        return super.getInstanceIdValue(id);
    }
}