本文整理了Java中org.mozilla.javascript.NativeArray.<init>()
方法的一些代码示例,展示了NativeArray.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NativeArray.<init>()
方法的具体详情如下:
包路径:org.mozilla.javascript.NativeArray
类名称:NativeArray
方法名:<init>
[英]Zero-parameter constructor: just used to create Array.prototype
[中]零参数构造函数:仅用于创建数组。原型
代码示例来源:origin: stackoverflow.com
Object[] fArgs = new Object[]{ new NativeArray(0) };
代码示例来源:origin: rhino/js
static void init(Scriptable scope, boolean sealed)
{
NativeArray obj = new NativeArray(0);
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
static void init(Scriptable scope, boolean sealed)
{
NativeArray obj = new NativeArray();
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
}
代码示例来源:origin: geogebra/geogebra
static void init(Scriptable scope, boolean sealed)
{
NativeArray obj = new NativeArray(0);
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
}
代码示例来源:origin: ro.isdc.wro4j/rhino
static void init(Scriptable scope, boolean sealed)
{
NativeArray obj = new NativeArray(0);
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
}
代码示例来源:origin: io.apigee/rhino
static void init(Scriptable scope, boolean sealed)
{
NativeArray obj = new NativeArray(0);
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
}
代码示例来源:origin: com.github.tntim96/rhino
static void init(Scriptable scope, boolean sealed)
{
NativeArray obj = new NativeArray(0);
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
}
代码示例来源:origin: rhino/js
/**
* Create an array with a specified initial length.
* <p>
* @param scope the scope to create the object in
* @param length the initial length (JavaScript arrays may have
* additional properties added dynamically).
* @return the new array object
*/
public final Scriptable newArray(Scriptable scope, int length)
{
NativeArray result = new NativeArray(length);
ScriptRuntime.setObjectProtoAndParent(result, scope);
return result;
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
/**
* Create an array with a specified initial length.
* <p>
* @param scope the scope to create the object in
* @param length the initial length (JavaScript arrays may have
* additional properties added dynamically).
* @return the new array object
*/
public final Scriptable newArray(Scriptable scope, int length)
{
NativeArray result = new NativeArray(length);
ScriptRuntime.setObjectProtoAndParent(result, scope);
return result;
}
代码示例来源:origin: io.apigee/rhino
/**
* Create an array with a specified initial length.
* <p>
* @param scope the scope to create the object in
* @param length the initial length (JavaScript arrays may have
* additional properties added dynamically).
* @return the new array object
*/
public Scriptable newArray(Scriptable scope, int length)
{
NativeArray result = new NativeArray(length);
ScriptRuntime.setBuiltinProtoAndParent(result, scope,
TopLevel.Builtins.Array);
return result;
}
代码示例来源:origin: com.github.tntim96/rhino
/**
* Create an array with a specified initial length.
* <p>
* @param scope the scope to create the object in
* @param length the initial length (JavaScript arrays may have
* additional properties added dynamically).
* @return the new array object
*/
public Scriptable newArray(Scriptable scope, int length)
{
NativeArray result = new NativeArray(length);
ScriptRuntime.setBuiltinProtoAndParent(result, scope,
TopLevel.Builtins.Array);
return result;
}
代码示例来源:origin: geogebra/geogebra
/**
* Create an array with a specified initial length.
* <p>
* @param scope the scope to create the object in
* @param length the initial length (JavaScript arrays may have
* additional properties added dynamically).
* @return the new array object
*/
public Scriptable newArray(Scriptable scope, int length)
{
NativeArray result = new NativeArray(length);
ScriptRuntime.setBuiltinProtoAndParent(result, scope,
TopLevel.Builtins.Array);
return result;
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Create an array with a specified initial length.
* <p>
* @param scope the scope to create the object in
* @param length the initial length (JavaScript arrays may have
* additional properties added dynamically).
* @return the new array object
*/
public Scriptable newArray(Scriptable scope, int length)
{
NativeArray result = new NativeArray(length);
ScriptRuntime.setBuiltinProtoAndParent(result, scope,
TopLevel.Builtins.Array);
return result;
}
代码示例来源:origin: rhino/js
/**
* Create an array with a set of initial elements.
*
* @param scope the scope to create the object in.
* @param elements the initial elements. Each object in this array
* must be an acceptable JavaScript type and type
* of array should be exactly Object[], not
* SomeObjectSubclass[].
* @return the new array object.
*/
public final Scriptable newArray(Scriptable scope, Object[] elements)
{
if (elements.getClass().getComponentType() != ScriptRuntime.ObjectClass)
throw new IllegalArgumentException();
NativeArray result = new NativeArray(elements);
ScriptRuntime.setObjectProtoAndParent(result, scope);
return result;
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
/**
* Create an array with a set of initial elements.
*
* @param scope the scope to create the object in.
* @param elements the initial elements. Each object in this array
* must be an acceptable JavaScript type and type
* of array should be exactly Object[], not
* SomeObjectSubclass[].
* @return the new array object.
*/
public final Scriptable newArray(Scriptable scope, Object[] elements)
{
if (elements.getClass().getComponentType() != ScriptRuntime.ObjectClass)
throw new IllegalArgumentException();
NativeArray result = new NativeArray(elements);
ScriptRuntime.setObjectProtoAndParent(result, scope);
return result;
}
代码示例来源:origin: com.github.tntim96/rhino
/**
* Create an array with a set of initial elements.
*
* @param scope the scope to create the object in.
* @param elements the initial elements. Each object in this array
* must be an acceptable JavaScript type and type
* of array should be exactly Object[], not
* SomeObjectSubclass[].
* @return the new array object.
*/
public Scriptable newArray(Scriptable scope, Object[] elements)
{
if (elements.getClass().getComponentType() != ScriptRuntime.ObjectClass)
throw new IllegalArgumentException();
NativeArray result = new NativeArray(elements);
ScriptRuntime.setBuiltinProtoAndParent(result, scope,
TopLevel.Builtins.Array);
return result;
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Create an array with a set of initial elements.
*
* @param scope the scope to create the object in.
* @param elements the initial elements. Each object in this array
* must be an acceptable JavaScript type and type
* of array should be exactly Object[], not
* SomeObjectSubclass[].
* @return the new array object.
*/
public Scriptable newArray(Scriptable scope, Object[] elements)
{
if (elements.getClass().getComponentType() != ScriptRuntime.ObjectClass)
throw new IllegalArgumentException();
NativeArray result = new NativeArray(elements);
ScriptRuntime.setBuiltinProtoAndParent(result, scope,
TopLevel.Builtins.Array);
return result;
}
代码示例来源:origin: org.apache.sling/org.apache.sling.scripting.javascript
public NativeArray jsFunction_getChildren() {
return new NativeArray(IteratorUtils.toArray(resource.listChildren()));
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.mashup.javascript.hostobjects.registry
public static NativeArray jsFunction_getPropertyValues(Context cx, Scriptable thisObj, Object[] arguments,
Function funObj) throws CarbonException {
ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
if (arguments.length == 1) {
if (arguments[0] instanceof String) {
return new NativeArray(resourceHostObject.resource.getPropertyValues((String) arguments[0]).toArray());
} else {
throw new CarbonException("Invalid argument type for getProperty() method");
}
} else {
throw new CarbonException("Invalid no. of arguments for getProperty() method");
}
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.mashup.javascript.hostobjects.registry
public Object jsGet_content() throws CarbonException {
try {
Object result = this.resource.getContent();
String mediaType = this.resource.getMediaType();
if (result instanceof byte[]) {
//if mediaType is xml related one, we return an e4x xml object
if(mediaType.matches(".*[\\/].*[xX][mM][lL].*")) {
return context.newObject(this, "XML", new Object[]{new String((byte[]) result)});
}
return new String((byte[]) result);
} else if (result instanceof String[]) {
return new NativeArray((String[])result);
} else {
return Context.toObject(result, this);
}
} catch (RegistryException e) {
throw new CarbonException("Registry Exception while reading content property", e);
}
}
内容来源于网络,如有侵权,请联系作者删除!