本文整理了Java中org.mozilla.javascript.ScriptableObject.getClassPrototype()
方法的一些代码示例,展示了ScriptableObject.getClassPrototype()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScriptableObject.getClassPrototype()
方法的具体详情如下:
包路径:org.mozilla.javascript.ScriptableObject
类名称:ScriptableObject
方法名:getClassPrototype
[英]Get the prototype for the named class. For example, getClassPrototype(s, "Date")
will first walk up the parent chain to find the outermost scope, then will search that scope for the Date constructor, and then will return Date.prototype. If any of the lookups fail, or the prototype is not a JavaScript object, then null will be returned.
[中]获取命名类的原型。例如,getClassPrototype(s, "Date")
将首先沿着父链查找最外层的作用域,然后在该作用域中搜索日期构造函数,然后返回日期。原型如果任何查找失败,或者原型不是JavaScript对象,那么将返回null。
代码示例来源:origin: rhino/js
public Scriptable getPrototype() {
if (prototype == null && javaObject instanceof String) {
return ScriptableObject.getClassPrototype(parent, "String");
}
return prototype;
}
代码示例来源:origin: rhino/js
/**
* Get the Object.prototype property.
* See ECMA 15.2.4.
*/
public static Scriptable getObjectPrototype(Scriptable scope) {
return getClassPrototype(scope, "Object");
}
代码示例来源:origin: rhino/js
/**
* Get the Function.prototype property.
* See ECMA 15.3.4.
*/
public static Scriptable getFunctionPrototype(Scriptable scope) {
return getClassPrototype(scope, "Function");
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
/**
* Get the Function.prototype property.
* See ECMA 15.3.4.
*/
public static Scriptable getFunctionPrototype(Scriptable scope) {
return getClassPrototype(scope, "Function");
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
public Scriptable getPrototype() {
if (prototype == null && javaObject instanceof String) {
return ScriptableObject.getClassPrototype(parent, "String");
}
return prototype;
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
/**
* Get the Object.prototype property.
* See ECMA 15.2.4.
*/
public static Scriptable getObjectPrototype(Scriptable scope) {
return getClassPrototype(scope, "Object");
}
代码示例来源:origin: com.atlassian.pluginkit/ringojs-kit
public static Scriptable getClassPrototype(Scriptable scope, String className)
{
return ScriptableObject.getClassPrototype(scope, className);
}
代码示例来源:origin: rhino/js
@Override
public Scriptable getPrototype() {
if (prototype == null) {
prototype =
ScriptableObject.getClassPrototype(this.getParentScope(),
"Array");
}
return prototype;
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
public Scriptable getPrototype() {
if (prototype == null) {
prototype =
ScriptableObject.getClassPrototype(this.getParentScope(),
"Array");
}
return prototype;
}
代码示例来源:origin: rhino/js
public static void setObjectProtoAndParent(ScriptableObject object,
Scriptable scope)
{
// Compared with function it always sets the scope to top scope
scope = ScriptableObject.getTopLevelScope(scope);
object.setParentScope(scope);
Scriptable proto
= ScriptableObject.getClassPrototype(scope, object.getClassName());
object.setPrototype(proto);
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
public static void setObjectProtoAndParent(ScriptableObject object,
Scriptable scope)
{
// Compared with function it always sets the scope to top scope
scope = ScriptableObject.getTopLevelScope(scope);
object.setParentScope(scope);
Scriptable proto
= ScriptableObject.getClassPrototype(scope, object.getClassName());
object.setPrototype(proto);
}
代码示例来源:origin: geogebra/geogebra
public static void setObjectProtoAndParent(ScriptableObject object,
Scriptable scope)
{
// Compared with function it always sets the scope to top scope
scope = ScriptableObject.getTopLevelScope(scope);
object.setParentScope(scope);
Scriptable proto
= ScriptableObject.getClassPrototype(scope, object.getClassName());
object.setPrototype(proto);
}
代码示例来源:origin: ro.isdc.wro4j/rhino
public static void setObjectProtoAndParent(ScriptableObject object,
Scriptable scope)
{
// Compared with function it always sets the scope to top scope
scope = ScriptableObject.getTopLevelScope(scope);
object.setParentScope(scope);
Scriptable proto
= ScriptableObject.getClassPrototype(scope, object.getClassName());
object.setPrototype(proto);
}
代码示例来源:origin: com.github.tntim96/rhino
public static void setObjectProtoAndParent(ScriptableObject object,
Scriptable scope)
{
// Compared with function it always sets the scope to top scope
scope = ScriptableObject.getTopLevelScope(scope);
object.setParentScope(scope);
Scriptable proto
= ScriptableObject.getClassPrototype(scope, object.getClassName());
object.setPrototype(proto);
}
代码示例来源:origin: io.apigee/rhino
public static void setObjectProtoAndParent(ScriptableObject object,
Scriptable scope)
{
// Compared with function it always sets the scope to top scope
scope = ScriptableObject.getTopLevelScope(scope);
object.setParentScope(scope);
Scriptable proto
= ScriptableObject.getClassPrototype(scope, object.getClassName());
object.setPrototype(proto);
}
代码示例来源:origin: org.apache.cocoon/cocoon-flowscript-impl
public void setupPackages(ClassLoader cl) throws Exception {
final String JAVA_PACKAGE = "JavaPackage";
if (classLoader != cl) {
classLoader = cl;
Scriptable newPackages = new NativeJavaPackage("", cl);
newPackages.setParentScope(this);
newPackages.setPrototype(ScriptableObject.getClassPrototype(this, JAVA_PACKAGE));
super.put("Packages", this, newPackages);
for (int i = 0; i < BUILTIN_PACKAGES.length; i++) {
String pkgName = BUILTIN_PACKAGES[i];
Scriptable pkg = new NativeJavaPackage(pkgName, cl);
pkg.setParentScope(this);
pkg.setPrototype(ScriptableObject.getClassPrototype(this, JAVA_PACKAGE));
super.put(pkgName, this, pkg);
}
}
}
代码示例来源:origin: org.apache.cocoon/cocoon-flowscript-impl
public PageLocal createPageLocal() {
PageLocalImpl pageLocal = new PageLocalImpl();
pageLocal.setPrototype(ScriptableObject.getClassPrototype(scope,
pageLocal.getClassName()));
pageLocal.setParentScope(scope);
pageLocal.setPageLocalScope(this);
return pageLocal;
}
}
代码示例来源:origin: org.apache.cocoon/cocoon-expression-language-impl
public Object getObject() {
Scriptable newPackages;
Context.enter();
try {
final String JAVA_PACKAGE = "JavaPackage";
ClassLoader cl = Thread.currentThread().getContextClassLoader();
// FIXME - NativeJavaPackage is an internal class which we should not use
newPackages = new NativeJavaPackage( "", cl );
newPackages.setParentScope( getScope() );
newPackages.setPrototype( ScriptableObject.getClassPrototype( getScope(),
JAVA_PACKAGE ) );
//objectModel.put( "Packages", newPackages );
//objectModel.put( "java", ScriptableObject.getProperty( getScope(), "java" ) );
} finally {
Context.exit();
}
return newPackages;
}
代码示例来源:origin: rhino/js
static Object newWithSpecial(Context cx, Scriptable scope, Object[] args)
{
ScriptRuntime.checkDeprecated(cx, "With");
scope = ScriptableObject.getTopLevelScope(scope);
NativeWith thisObj = new NativeWith();
thisObj.setPrototype(args.length == 0
? ScriptableObject.getClassPrototype(scope,
"Object")
: ScriptRuntime.toObject(cx, scope, args[0]));
thisObj.setParentScope(scope);
return thisObj;
}
代码示例来源:origin: com.sun.phobos/phobos-rhino
static Object newWithSpecial(Context cx, Scriptable scope, Object[] args)
{
ScriptRuntime.checkDeprecated(cx, "With");
scope = ScriptableObject.getTopLevelScope(scope);
NativeWith thisObj = new NativeWith();
thisObj.setPrototype(args.length == 0
? ScriptableObject.getClassPrototype(scope,
"Object")
: ScriptRuntime.toObject(cx, scope, args[0]));
thisObj.setParentScope(scope);
return thisObj;
}
内容来源于网络,如有侵权,请联系作者删除!