本文整理汇总了Java中jdk.nashorn.internal.runtime.Undefined.getUndefined方法的典型用法代码示例。如果您正苦于以下问题:Java Undefined.getUndefined方法的具体用法?Java Undefined.getUndefined怎么用?Java Undefined.getUndefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.runtime.Undefined
的用法示例。
在下文中一共展示了Undefined.getUndefined方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toJSValue
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
public static Object toJSValue(Value value){
if(value == null)
return Undefined.getUndefined();
if(value == Value.VOID)
return Undefined.getUndefined();
if(value.isString())
return new JSStringValue(value);
if(value.isBoolean()|| value.isNumber())
return value.get();
if(value.isFunction())
return new JSFunction(value);
if(value.isArray())
return new JSArray(value);
if(value.isMap())
return new JSMap(value);
return Undefined.getUndefined();
}
示例2: constructor
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
/**
* ECMA 6 19.4.1.1 Symbol ( [ description ] )
*
* @param newObj is this function invoked with the new operator
* @param self self reference
* @param args arguments
* @return new symbol value
*/
@Constructor(arity = 1)
public static Object constructor(final boolean newObj, final Object self, final Object... args) {
if (newObj) {
throw typeError("symbol.as.constructor");
}
final String description = args.length > 0 && args[0] != Undefined.getUndefined() ?
JSType.toString(args[0]) : "";
return new Symbol(description);
}
示例3: keyFor
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
/**
* ES6 19.4.2.5 Symbol.keyFor ( sym )
*
* @param self self reference
* @param arg the argument
* @return the symbol name
*/
@Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
public synchronized static Object keyFor(final Object self, final Object arg) {
if (!(arg instanceof Symbol)) {
throw typeError("not.a.symbol", ScriptRuntime.safeToString(arg));
}
final String name = ((Symbol) arg).getName();
return globalSymbolRegistry.get(name) == arg ? name : Undefined.getUndefined();
}
示例4: populateWeakSet
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
static void populateWeakSet(final Map<Object, Boolean> set, final Object arg, final Global global) {
if (arg != null && arg != Undefined.getUndefined()) {
AbstractIterator.iterate(arg, global, value -> {
set.put(checkKey(value), Boolean.TRUE);
});
}
}
示例5: populateMap
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
static void populateMap(final LinkedMap map, final Object arg, final Global global) {
if (arg != null && arg != Undefined.getUndefined()) {
AbstractIterator.iterate(arg, global, value -> {
if (JSType.isPrimitive(value)) {
throw typeError(global, "not.an.object", ScriptRuntime.safeToString(value));
}
if (value instanceof ScriptObject) {
final ScriptObject sobj = (ScriptObject) value;
map.set(convertKey(sobj.get(0)), sobj.get(1));
}
});
}
}
示例6: get
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
/**
* ECMA6 23.3.3.3 WeakMap.prototype.get ( key )
*
* @param self the self reference
* @param key the key
* @return the associated value or undefined
*/
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static Object get(final Object self, final Object key) {
final NativeWeakMap map = getMap(self);
if (isPrimitive(key)) {
return Undefined.getUndefined();
}
return map.jmap.get(key);
}
示例7: populateMap
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
static void populateMap(final Map<Object, Object> map, final Object arg, final Global global) {
// This method is similar to NativeMap.populateMap, but it uses a different
// map implementation and the checking/conversion of keys differs as well.
if (arg != null && arg != Undefined.getUndefined()) {
AbstractIterator.iterate(arg, global, value -> {
if (isPrimitive(value)) {
throw typeError(global, "not.an.object", ScriptRuntime.safeToString(value));
}
if (value instanceof ScriptObject) {
final ScriptObject sobj = (ScriptObject) value;
map.put(checkKey(sobj.get(0)), sobj.get(1));
}
});
}
}
示例8: getMember
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
@Override
public Object getMember(String s) {
if(s.equals("toString"))
return toString;
return Undefined.getUndefined();
}
示例9: getDifferentUndefined
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private static Object getDifferentUndefined(final int programPoint) {
throw new UnwarrantedOptimismException(Undefined.getUndefined(), programPoint);
}
示例10: populateSet
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
static void populateSet(final LinkedMap map, final Object arg, final Global global) {
if (arg != null && arg != Undefined.getUndefined()) {
AbstractIterator.iterate(arg, global, value -> map.set(convertKey(value), null));
}
}
示例11: getUndefined
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
public Object getUndefined() {
return Undefined.getUndefined();
}
示例12: get
import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
/**
* Get the value associated with {@code key}.
* @param key the key
* @return the associated value, or {@code null} if {@code key} is not contained in the map
*/
public Object get(final Object key) {
final Node node = data.get(key);
return node == null ? Undefined.getUndefined() : node.getValue();
}