Example usage for jdk.nashorn.internal.objects Global newEmptyInstance

List of usage examples for jdk.nashorn.internal.objects Global newEmptyInstance

Introduction

In this page you can find the example usage for jdk.nashorn.internal.objects Global newEmptyInstance.

Prototype

public static ScriptObject newEmptyInstance() 

Source Link

Document

Create a new empty object instance.

Usage

From source file:com.threecrickets.jvm.json.nashorn.NashornJsonImplementation.java

License:Mozilla Public License

public Object createObject() {
    return Global.newEmptyInstance();
}

From source file:com.threecrickets.jvm.json.nashorn.util.NashornNativeUtil.java

License:Mozilla Public License

public static ScriptObject newObject() {
    return Global.newEmptyInstance();
}

From source file:org.bson.jvm.nashorn.ScriptObjectCodec.java

License:Apache License

public Object decode(BsonReader reader, DecoderContext decoderContext) {
    ScriptObject scriptObject = Global.newEmptyInstance();

    reader.readStartDocument();//from   ww w  .jav  a 2  s.c  o  m
    while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) {
        String key = reader.readName();
        Object value = BsonUtil.read(reader, decoderContext, codecRegistry, bsonTypeClassMap);
        scriptObject.put(key, value, false);
    }
    reader.readEndDocument();

    // The driver does not support decoding DBRef, so we'll do it here
    Object dbRef = new DBRefTransformer().transform(scriptObject, null);
    if (dbRef != null)
        return dbRef;

    return scriptObject;
}