当前位置: 首页>>代码示例>>Java>>正文


Java Undefined.getUndefined方法代码示例

本文整理汇总了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();
}
 
开发者ID:djxy,项目名称:MultiScripts,代码行数:25,代码来源:Util.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:NativeSymbol.java

示例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();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:NativeSymbol.java

示例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);
        });
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:NativeWeakSet.java

示例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));
            }
        });
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:NativeMap.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:NativeWeakMap.java

示例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));
            }
        });
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:NativeWeakMap.java

示例8: getMember

import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
@Override
public Object getMember(String s) {
    if(s.equals("toString"))
        return toString;

    return Undefined.getUndefined();
}
 
开发者ID:djxy,项目名称:MultiScripts,代码行数:8,代码来源:JSFunction.java

示例9: getDifferentUndefined

import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private static Object getDifferentUndefined(final int programPoint) {
    throw new UnwarrantedOptimismException(Undefined.getUndefined(), programPoint);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:ObjectClassGenerator.java

示例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));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:NativeSet.java

示例11: getUndefined

import jdk.nashorn.internal.runtime.Undefined; //导入方法依赖的package包/类
public Object getUndefined() {
    return Undefined.getUndefined();
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:4,代码来源:Scripts.java

示例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();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:LinkedMap.java


注:本文中的jdk.nashorn.internal.runtime.Undefined.getUndefined方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。