本文整理了Java中com.eclipsesource.v8.V8Array.pushUndefined()
方法的一些代码示例,展示了V8Array.pushUndefined()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。V8Array.pushUndefined()
方法的具体详情如下:
包路径:com.eclipsesource.v8.V8Array
类名称:V8Array
方法名:pushUndefined
[英]Pushes undefined to the next available spot in the Array. In particular, this[length] = undefined;
[中]将“未定义”推送到阵列中的下一个可用位置。特别是,这个[长度]=未定义;
代码示例来源:origin: eclipsesource/J2V8
@SuppressWarnings({ "unchecked", "rawtypes", "resource" })
private static void pushValue(final V8 v8, final V8Array result, final Object value, final Map<Object, V8Value> cache) {
if (value == null) {
result.pushUndefined();
} else if (value instanceof Integer) {
result.push(value);
代码示例来源:origin: eclipsesource/J2V8
@Test(expected = UnsupportedOperationException.class)
public void testPushUndefinedUndefined() {
V8Array undefined = v8.getArray("array");
undefined.pushUndefined();
}
代码示例来源:origin: eclipsesource/J2V8
@Test(expected = V8RuntimeException.class)
public void testCannotPushUndefinedToTypedArray() {
V8Array array = (V8Array) v8.executeScript("var buf = new ArrayBuffer(8); var ints = new Int32Array(buf); ints");
try {
array.pushUndefined();
} finally {
array.close();
}
}
代码示例来源:origin: eclipsesource/J2V8
@Test
public void testCannotPushUndefinedToTypedArray_CheckMessage() {
V8Array array = (V8Array) v8.executeScript("var buf = new ArrayBuffer(8); var ints = new Int32Array(buf); ints");
try {
array.pushUndefined();
} catch (Exception e) {
assertEquals("Cannot push to a Typed Array.", e.getMessage());
return;
} finally {
array.close();
}
fail("Expected failure");
}
代码示例来源:origin: eclipsesource/J2V8
@SuppressWarnings({ "unchecked", "rawtypes", "resource" })
private static void pushValue(final V8 v8, final V8Array result, final Object value, final Map<Object, V8Value> cache) {
if (value == null) {
result.pushUndefined();
} else if (value instanceof Integer) {
result.push(value);
代码示例来源:origin: eclipsesource/J2V8
@Test
public void testAddUndefined() {
V8Array v8Array = new V8Array(v8);
v8Array.pushUndefined();
assertEquals(1, v8Array.length());
assertEquals(UNDEFINED, v8Array.getType(0));
v8Array.close();
}
代码示例来源:origin: eclipsesource/J2V8
@Test
public void testAddMixedValues() {
V8Array array = new V8Array(v8);
array.push(true);
array.push(false);
array.push(1);
array.push("string");
array.push(false);
array.pushUndefined();
assertEquals(6, array.length());
assertTrue(array.getBoolean(0));
assertFalse(array.getBoolean(1));
assertEquals(1, array.getInteger(2));
assertEquals("string", array.getString(3));
assertFalse(array.getBoolean(4));
assertEquals(UNDEFINED, array.getType(5));
array.close();
}
代码示例来源:origin: com.eclipsesource.j2v8/j2v8_win32_x86_64
@SuppressWarnings({ "unchecked", "rawtypes" })
private static void pushValue(final V8 v8, final V8Array result, final Object value, final Map<Object, V8Value> cache) {
if (value == null) {
result.pushUndefined();
} else if (value instanceof Integer) {
result.push((Integer) value);
代码示例来源:origin: com.eclipsesource.j2v8/j2v8_macosx_x86_64
@SuppressWarnings({ "unchecked", "rawtypes" })
private static void pushValue(final V8 v8, final V8Array result, final Object value, final Map<Object, V8Value> cache) {
if (value == null) {
result.pushUndefined();
} else if (value instanceof Integer) {
result.push((Integer) value);
内容来源于网络,如有侵权,请联系作者删除!