src/jdk/nashorn/internal/objects/NativeDate.java

Print this page




  97     };
  98 
  99     private static final Object TO_ISO_STRING = new Object();
 100 
 101     private static InvokeByName getTO_ISO_STRING() {
 102         return Global.instance().getInvokeByName(TO_ISO_STRING,
 103                 new Callable<InvokeByName>() {
 104                     @Override
 105                     public InvokeByName call() {
 106                         return new InvokeByName("toISOString", ScriptObject.class, Object.class, Object.class);
 107                     }
 108                 });
 109     }
 110 
 111     private double time;
 112     private final TimeZone timezone;
 113 
 114     // initialized by nasgen
 115     private static PropertyMap $nasgenmap$;
 116 
 117     static PropertyMap getInitialMap() {
 118         return $nasgenmap$;
 119     }
 120 
 121     private NativeDate(final double time, final ScriptObject proto, final PropertyMap map) {
 122         super(proto, map);
 123         final ScriptEnvironment env = Global.getEnv();
 124 
 125         this.time = time;
 126         this.timezone = env._timezone;
 127     }
 128 
 129     NativeDate(final double time, final Global global) {
 130         this(time, global.getDatePrototype(), getInitialMap());
 131     }
 132 
 133     private NativeDate (final double time) {
 134         this(time, Global.instance());
 135     }
 136 
 137     private NativeDate() {
 138         this(System.currentTimeMillis());
 139     }
 140 
 141     @Override
 142     public String getClassName() {
 143         return "Date";
 144     }
 145 
 146     // ECMA 8.12.8 [[DefaultValue]] (hint)
 147     @Override
 148     public Object getDefaultValue(final Class<?> hint) {
 149         // When the [[DefaultValue]] internal method of O is called with no hint,
 150         // then it behaves as if the hint were Number, unless O is a Date object




  97     };
  98 
  99     private static final Object TO_ISO_STRING = new Object();
 100 
 101     private static InvokeByName getTO_ISO_STRING() {
 102         return Global.instance().getInvokeByName(TO_ISO_STRING,
 103                 new Callable<InvokeByName>() {
 104                     @Override
 105                     public InvokeByName call() {
 106                         return new InvokeByName("toISOString", ScriptObject.class, Object.class, Object.class);
 107                     }
 108                 });
 109     }
 110 
 111     private double time;
 112     private final TimeZone timezone;
 113 
 114     // initialized by nasgen
 115     private static PropertyMap $nasgenmap$;
 116 




 117     private NativeDate(final double time, final ScriptObject proto, final PropertyMap map) {
 118         super(proto, map);
 119         final ScriptEnvironment env = Global.getEnv();
 120 
 121         this.time = time;
 122         this.timezone = env._timezone;
 123     }
 124 
 125     NativeDate(final double time, final Global global) {
 126         this(time, global.getDatePrototype(), $nasgenmap$);
 127     }
 128 
 129     private NativeDate (final double time) {
 130         this(time, Global.instance());
 131     }
 132 
 133     private NativeDate() {
 134         this(System.currentTimeMillis());
 135     }
 136 
 137     @Override
 138     public String getClassName() {
 139         return "Date";
 140     }
 141 
 142     // ECMA 8.12.8 [[DefaultValue]] (hint)
 143     @Override
 144     public Object getDefaultValue(final Class<?> hint) {
 145         // When the [[DefaultValue]] internal method of O is called with no hint,
 146         // then it behaves as if the hint were Number, unless O is a Date object