Example usage for jdk.nashorn.internal.objects NativeDate construct

List of usage examples for jdk.nashorn.internal.objects NativeDate construct

Introduction

In this page you can find the example usage for jdk.nashorn.internal.objects NativeDate construct.

Prototype

@Constructor(arity = 7)
public static Object construct(final boolean isNew, final Object self, final Object... args) 

Source Link

Document

Constructor - ECMA 15.9.3.1 new Date (year, month [, date [, hours [, minutes [, seconds [, ms ] ] ] ] ] )

Usage

From source file:com.mongodb.jvm.json.nashorn.NativeDateTransformer.java

License:Apache License

public Object transform(Object object, JsonImplementation implementation) {
    if (object instanceof ScriptObject) {
        Object date = ((ScriptObject) object).get("$date");
        if ((date != null) && (date.getClass() != Undefined.class))
            return NativeDate.construct(true, null, date);
    }//from  w w  w. j a  v a  2  s  .co  m

    return null;
}

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

License:Mozilla Public License

public static NativeDate to(Date date) {
    return (NativeDate) NativeDate.construct(true, null, date.getTime());
}

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

License:Apache License

public NativeDate decode(BsonReader reader, DecoderContext decoderContext) {
    return (NativeDate) NativeDate.construct(true, null, reader.readDateTime());
}