本文整理匯總了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);
}