本文整理汇总了Java中jdk.nashorn.internal.runtime.GlobalObject类的典型用法代码示例。如果您正苦于以下问题:Java GlobalObject类的具体用法?Java GlobalObject怎么用?Java GlobalObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GlobalObject类属于jdk.nashorn.internal.runtime包,在下文中一共展示了GlobalObject类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: globalFromMirror
import jdk.nashorn.internal.runtime.GlobalObject; //导入依赖的package包/类
private ScriptObject globalFromMirror(final ScriptObjectMirror mirror) {
ScriptObject sobj = mirror.getScriptObject();
if (sobj instanceof GlobalObject && isOfContext(sobj, nashornContext)) {
return sobj;
}
return null;
}
示例2: setContextVariables
import jdk.nashorn.internal.runtime.GlobalObject; //导入依赖的package包/类
private void setContextVariables(final ScriptObject ctxtGlobal, final ScriptContext ctxt) {
// set "context" global variable via contextProperty - because this
// property is non-writable
contextProperty.setObjectValue(ctxtGlobal, ctxtGlobal, ctxt, false);
Object args = ScriptObjectMirror.unwrap(ctxt.getAttribute("arguments"), ctxtGlobal);
if (args == null || args == UNDEFINED) {
args = ScriptRuntime.EMPTY_ARRAY;
}
// if no arguments passed, expose it
if (! (args instanceof ScriptObject)) {
args = ((GlobalObject)ctxtGlobal).wrapAsObject(args);
ctxtGlobal.set("arguments", args, false);
}
}
示例3: getGuardedInvocation
import jdk.nashorn.internal.runtime.GlobalObject; //导入依赖的package包/类
@Override
public GuardedInvocation getGuardedInvocation(final LinkRequest origRequest, final LinkerServices linkerServices)
throws Exception {
final LinkRequest request = origRequest.withoutRuntimeContext(); // Nashorn has no runtime context
final Object self = request.getReceiver();
final GlobalObject global = (GlobalObject) Context.getGlobal();
final NashornCallSiteDescriptor desc = (NashornCallSiteDescriptor) request.getCallSiteDescriptor();
return Bootstrap.asType(global.primitiveLookup(request, self), linkerServices, desc);
}
示例4: getDescriptor
import jdk.nashorn.internal.runtime.GlobalObject; //导入依赖的package包/类
@Override
public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) {
return global.newDataDescriptor(getObject(index), false, true, false);
}
示例5: getDescriptor
import jdk.nashorn.internal.runtime.GlobalObject; //导入依赖的package包/类
@Override
public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) {
return global.newDataDescriptor(getObject(index), false, true, true);
}
示例6: getDescriptor
import jdk.nashorn.internal.runtime.GlobalObject; //导入依赖的package包/类
/**
* Returns property descriptor for element at a given index
*
* @param global the global object
* @param index the index
*
* @return property descriptor for element
*/
public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) {
return global.newDataDescriptor(getObject(index), true, true, true);
}