-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDuration.bal
More file actions
1045 lines (906 loc) · 38.7 KB
/
Copy pathDuration.bal
File metadata and controls
1045 lines (906 loc) · 38.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import ballerina/jballerina.java;
# Ballerina class mapping for the Java `java.time.Duration` class.
@java:Binding {'class: "java.time.Duration"}
public distinct class Duration {
*java:JObject;
*Object;
# The underlying Java object reference.
public handle jObj;
# Initializes the Ballerina wrapper with a Java reference.
#
# + obj - The `handle` value containing the Java reference.
public function init(handle obj) {
self.jObj = obj;
}
# Returns the string representation of the duration.
#
# + return - The string form of the duration instance.
public function toString() returns string {
return java:toString(self.jObj) ?: "";
}
# Returns a copy of this duration with a positive length.
#
# + return - A duration with a positive length.
public function abs() returns Duration {
handle externalObj = java_time_Duration_abs(self.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Adds this duration to the specified temporal object.
#
# + temporal - The temporal object to add to.
# + return - The resulting temporal object.
function addTo(Temporal temporal) returns Temporal {
handle externalObj = java_time_Duration_addTo(self.jObj, temporal.jObj);
Temporal newObj = new (externalObj);
return newObj;
}
# Compares this duration to another duration.
#
# + other - The other duration to compare with.
# + return - Negative, zero, or positive as this duration is less than, equal to, or greater than the other.
public function compareTo(Duration other) returns int {
return java_time_Duration_compareTo(self.jObj, other.jObj);
}
# Divides this duration by another duration.
#
# + other - The other duration to divide by.
# + return - The ratio of the durations as an integer.
public function dividedByDuration(Duration other) returns int {
return java_time_Duration_dividedBy(self.jObj, other.jObj);
}
# Divides this duration by the specified value.
#
# + divisor - The value to divide by.
# + return - A duration-representing the result of the division.
public function dividedBy(int divisor) returns Duration {
handle externalObj = java_time_Duration_dividedBy2(self.jObj, divisor);
Duration newObj = new (externalObj);
return newObj;
}
# Checks if this duration is equal to another object.
#
# + other - The object to check equality with.
# + return - True if this duration is equal to the other object, false otherwise.
public function isEquals(Object other) returns boolean {
return java_time_Duration_equals(self.jObj, other.jObj);
}
# Gets the value of the requested unit.
#
# + unit - The `TemporalUnit` for which to return the value.
# + return - The long value for the unit.
function get(TemporalUnit unit) returns int {
return java_time_Duration_get(self.jObj, unit.jObj);
}
# Gets the runtime class of this duration.
#
# + return - The `Class` object representing the runtime class.
public function getClass() returns Class {
handle externalObj = java_time_Duration_getClass(self.jObj);
Class newObj = new (externalObj);
return newObj;
}
# Gets the number of nanoseconds in the second-based part of this duration.
#
# + return - The number of nanoseconds, from 0 to 999,999,999.
public function getNano() returns int {
return java_time_Duration_getNano(self.jObj);
}
# Gets the number of seconds in this duration.
#
# + return - The whole seconds part of the duration.
public function getSeconds() returns int {
return java_time_Duration_getSeconds(self.jObj);
}
# Gets the list of units supported by this duration.
#
# + return - A `List` containing the supported `TemporalUnit` instances.
public function getUnits() returns List {
handle externalObj = java_time_Duration_getUnits(self.jObj);
List newObj = new (externalObj);
return newObj;
}
# Returns a hash code for this duration.
#
# + return - A suitable hash code value.
public function hashCode() returns int {
return java_time_Duration_hashCode(self.jObj);
}
# Checks if this duration is negative, excluding zero.
#
# + return - True if this duration has a total length less than zero, false otherwise.
public function isNegative() returns boolean {
return java_time_Duration_isNegative(self.jObj);
}
# Checks if this duration is positive, excluding zero.
#
# + return - True if this duration has a total length greater than zero, false otherwise.
public function isPositive() returns boolean {
return java_time_Duration_isPositive(self.jObj);
}
# Checks if this duration is zero length.
#
# + return - True if this duration has a total length of zero, false otherwise.
public function isZero() returns boolean {
return java_time_Duration_isZero(self.jObj);
}
# Returns a copy of this duration with the specified duration subtracted.
#
# + other - The duration to subtract, not null.
# + return - A duration based on this duration with the specified duration subtracted.
public function minus(Duration other) returns Duration {
handle externalObj = java_time_Duration_minus(self.jObj, other.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified amount subtracted.
#
# + amount - The amount of the unit to subtract, measured in terms of the unit.
# + unit - The unit that the amount is measured in, not null.
# + return - A duration based on this duration with the specified amount subtracted.
function minus2(int amount, TemporalUnit unit) returns Duration {
handle externalObj = java_time_Duration_minus2(self.jObj, amount, unit.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of days subtracted.
#
# + days - The days to subtract, positive or negative.
# + return - A duration based on this duration with the specified days subtracted.
public function minusDays(int days) returns Duration {
handle externalObj = java_time_Duration_minusDays(self.jObj, days);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of hours subtracted.
#
# + hours - The hours to subtract, positive or negative.
# + return - A duration based on this duration with the specified hours subtracted.
public function minusHours(int hours) returns Duration {
handle externalObj = java_time_Duration_minusHours(self.jObj, hours);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of milliseconds subtracted.
#
# + millis - The milliseconds to subtract, positive or negative.
# + return - A duration based on this duration with the specified milliseconds subtracted.
public function minusMillis(int millis) returns Duration {
handle externalObj = java_time_Duration_minusMillis(self.jObj, millis);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of minutes subtracted.
#
# + minutes - The minutes to subtract, positive or negative.
# + return - A duration based on this duration with the specified minutes subtracted.
public function minusMinutes(int minutes) returns Duration {
handle externalObj = java_time_Duration_minusMinutes(self.jObj, minutes);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of nanoseconds subtracted.
#
# + nanos - The nanoseconds to subtract, positive or negative.
# + return - A duration based on this duration with the specified nanoseconds subtracted.
public function minusNanos(int nanos) returns Duration {
handle externalObj = java_time_Duration_minusNanos(self.jObj, nanos);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of seconds subtracted.
#
# + seconds - The seconds to subtract, positive or negative.
# + return - A duration based on this duration with the specified seconds subtracted.
public function minusSeconds(int seconds) returns Duration {
handle externalObj = java_time_Duration_minusSeconds(self.jObj, seconds);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration multiplied by the specified scalar.
#
# + multiplier - The value to multiply by, positive or negative.
# + return - A duration based on this duration multiplied by the scalar.
public function multipliedBy(int multiplier) returns Duration {
handle externalObj = java_time_Duration_multipliedBy(self.jObj, multiplier);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the length negated.
#
# + return - A duration based on this duration with the amount negated.
public function negated() returns Duration {
handle externalObj = java_time_Duration_negated(self.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Wakes up a single thread that is waiting on this object's monitor.
public function notify() {
java_time_Duration_notify(self.jObj);
}
# Wakes up all threads that are waiting on this object's monitor.
public function notifyAll() {
java_time_Duration_notifyAll(self.jObj);
}
# Returns a copy of this duration with the specified duration added.
#
# + other - The duration to add, not null.
# + return - A duration based on this duration with the specified duration added.
public function plus(Duration other) returns Duration {
handle externalObj = java_time_Duration_plus(self.jObj, other.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified amount added.
#
# + amount - The amount of the unit to add, measured in terms of the unit.
# + unit - The unit that the amount is measured in, not null.
# + return - A duration based on this duration with the specified amount added.
function plus2(int amount, TemporalUnit unit) returns Duration {
handle externalObj = java_time_Duration_plus2(self.jObj, amount, unit.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of days added.
#
# + days - The days to add, positive or negative.
# + return - A duration based on this duration with the specified days added.
public function plusDays(int days) returns Duration {
handle externalObj = java_time_Duration_plusDays(self.jObj, days);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of hours added.
#
# + hours - The hours to add, positive or negative.
# + return - A duration based on this duration with the specified hours added.
public function plusHours(int hours) returns Duration {
handle externalObj = java_time_Duration_plusHours(self.jObj, hours);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of milliseconds added.
#
# + millis - The milliseconds to add, positive or negative.
# + return - A duration based on this duration with the specified milliseconds added.
public function plusMillis(int millis) returns Duration {
handle externalObj = java_time_Duration_plusMillis(self.jObj, millis);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of minutes added.
#
# + minutes - The minutes to add, positive or negative.
# + return - A duration based on this duration with the specified minutes added.
public function plusMinutes(int minutes) returns Duration {
handle externalObj = java_time_Duration_plusMinutes(self.jObj, minutes);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of nanoseconds added.
#
# + nanos - The nanoseconds to add, positive or negative.
# + return - A duration based on this duration with the specified nanoseconds added.
public function plusNanos(int nanos) returns Duration {
handle externalObj = java_time_Duration_plusNanos(self.jObj, nanos);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of seconds added.
#
# + seconds - The seconds to add, positive or negative.
# + return - A duration based on this duration with the specified seconds added.
public function plusSeconds(int seconds) returns Duration {
handle externalObj = java_time_Duration_plusSeconds(self.jObj, seconds);
Duration newObj = new (externalObj);
return newObj;
}
# Subtracts this duration from the specified temporal object.
#
# + temporal - The temporal object to subtract from.
# + return - The resulting temporal object.
function subtractFrom(Temporal temporal) returns Temporal {
handle externalObj = java_time_Duration_subtractFrom(self.jObj, temporal.jObj);
Temporal newObj = new (externalObj);
return newObj;
}
# Gets the number of days in this duration.
#
# + return - The total number of days in the duration.
public function toDays() returns int {
return java_time_Duration_toDays(self.jObj);
}
# Extracts the number of days in this duration.
#
# + return - The number of days part, after dividing out the hours, minutes and seconds.
public function toDaysPart() returns int {
return java_time_Duration_toDaysPart(self.jObj);
}
# Gets the number of hours in this duration.
#
# + return - The total number of hours in the duration.
public function toHours() returns int {
return java_time_Duration_toHours(self.jObj);
}
# Extracts the number of hours part in this duration.
#
# + return - The number of hours part, in the range 0 to 23.
public function toHoursPart() returns int {
return java_time_Duration_toHoursPart(self.jObj);
}
# Gets the number of milliseconds in this duration.
#
# + return - The total number of milliseconds in the duration.
public function toMillis() returns int {
return java_time_Duration_toMillis(self.jObj);
}
# Extracts the number of milliseconds part in this duration.
#
# + return - The number of milliseconds part, in the range 0 to 999.
public function toMillisPart() returns int {
return java_time_Duration_toMillisPart(self.jObj);
}
# Gets the number of minutes in this duration.
#
# + return - The total number of minutes in the duration.
public function toMinutes() returns int {
return java_time_Duration_toMinutes(self.jObj);
}
# Extracts the number of minutes part in this duration.
#
# + return - The number of minutes part, in the range 0 to 59.
public function toMinutesPart() returns int {
return java_time_Duration_toMinutesPart(self.jObj);
}
# Gets the total number of nanoseconds in this duration.
#
# + return - The total number of nanoseconds in the duration.
public function toNanos() returns int {
return java_time_Duration_toNanos(self.jObj);
}
# Extracts the number of nanoseconds part in this duration.
#
# + return - The number of nanoseconds part, in the range 0 to 999,999,999.
public function toNanosPart() returns int {
return java_time_Duration_toNanosPart(self.jObj);
}
# Gets the number of seconds in this duration.
#
# + return - The total number of seconds in the duration.
public function toSeconds() returns int {
return java_time_Duration_toSeconds(self.jObj);
}
# Extracts the number of seconds part in this duration.
#
# + return - The number of seconds part, in the range 0 to 59.
public function toSecondsPart() returns int {
return java_time_Duration_toSecondsPart(self.jObj);
}
# Returns a copy of this duration truncated to the specified unit.
#
# + unit - The unit to truncate to, not null.
# + return - A duration based on this duration with the specified unit truncated.
function truncatedTo(TemporalUnit unit) returns Duration {
handle externalObj = java_time_Duration_truncatedTo(self.jObj, unit.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Causes the current thread to wait until another thread invokes the notify() or notifyAll() methods for this object.
#
# + return - An `InterruptedException` if the thread was interrupted while waiting, or nil otherwise.
public function doWait() returns InterruptedException? {
error|() externalObj = java_time_Duration_wait(self.jObj);
if (externalObj is error) {
InterruptedException e = error InterruptedException(INTERRUPTEDEXCEPTION, externalObj, message = externalObj.message());
return e;
}
}
# Causes the current thread to wait until another thread invokes notify() or notifyAll() for this object, or a certain amount of real time has elapsed.
#
# + millis - The maximum time to wait in milliseconds.
# + return - An `InterruptedException` if the thread was interrupted while waiting, or nil otherwise.
public function waitWithTimeout(int millis) returns InterruptedException? {
error|() externalObj = java_time_Duration_wait2(self.jObj, millis);
if (externalObj is error) {
InterruptedException e = error InterruptedException(INTERRUPTEDEXCEPTION, externalObj, message = externalObj.message());
return e;
}
}
# Causes the current thread to wait until another thread invokes notify() or notifyAll() for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
#
# + millis - The maximum time to wait in milliseconds.
# + nanos - Additional nanoseconds, in the range 0-999,999.
# + return - An `InterruptedException` if the thread was interrupted while waiting, or nil otherwise.
public function waitWithTimeoutAndNanos(int millis, int nanos) returns InterruptedException? {
error|() externalObj = java_time_Duration_wait3(self.jObj, millis, nanos);
if (externalObj is error) {
InterruptedException e = error InterruptedException(INTERRUPTEDEXCEPTION, externalObj, message = externalObj.message());
return e;
}
}
# Returns a copy of this duration with the specified number of nanoseconds.
#
# + nanos - The number of nanoseconds to represent, from 0 to 999,999,999.
# + return - A duration based on this duration with the requested nanoseconds.
public function withNanos(int nanos) returns Duration {
handle externalObj = java_time_Duration_withNanos(self.jObj, nanos);
Duration newObj = new (externalObj);
return newObj;
}
# Returns a copy of this duration with the specified number of seconds.
#
# + seconds - The number of seconds, positive or negative.
# + return - A duration based on this duration with the requested seconds.
public function withSeconds(int seconds) returns Duration {
handle externalObj = java_time_Duration_withSeconds(self.jObj, seconds);
Duration newObj = new (externalObj);
return newObj;
}
}
# Obtains a `Duration` representing the duration between two temporal objects.
#
# Both arguments must represent a compatible kind of time. Two values of the same type
# (for example, two `LocalDateTime`s) always work. Mixing an absolute type (`Instant`,
# `ZonedDateTime`) with another absolute type also works, since both carry enough
# information (an instant, or a local date-time plus zone) to be compared directly.
# Mixing an absolute type with a zone-less type (`LocalDateTime`, `LocalTime`) will result
# in an error, since there's no way to know which time-zone the zone-less value refers to —
# in that case, first attach an explicit zone using `.atZone(zone)`. `LocalDate` is not
# supported at all, since a duration in hours/minutes/seconds has no meaning for a value
# with no time component — use `betweenPeriod` for date-only differences instead.
#
# + startInclusive - The start time object (inclusive), not null
# + endExclusive - The end time object (exclusive), not null
# + return - The duration between the start and end time objects, or an error if the two
# objects cannot be compared
public function between(LocalDateTime|LocalTime|Instant|ZonedDateTime startInclusive, LocalDateTime|LocalTime|Instant|ZonedDateTime endExclusive) returns Duration|error {
handle externalObj = check trap java_time_Duration_between(startInclusive.jObj, endExclusive.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Obtains an instance of `Duration` from a temporal amount.
#
# NOT CURRENTLY USABLE — kept only as a placeholder for future extension, do not remove
# the underlying binding without checking this note first.
#
# `Duration.from(TemporalAmount)` is designed to accept any implementation of `TemporalAmount`
# generically. But Period.getUnits() unconditionally returns [YEARS, MONTHS, DAYS] — even
# when those values are zero — and `Duration` cannot represent YEARS/MONTHS (variable-length
# units). As a result, calling this with ANY `Period` value, including `Period.ZERO`, will
# always throw `UnsupportedTemporalTypeException: Unsupported unit: Years` at the Java level.
# This is a known, well-documented Java gotcha, not a bug in this binding
# (see https://bugs.openjdk.org/browse/JDK-8170275 for the analogous Duration.between(LocalDate)
# issue, which fails for the identical reason).
#
# There is currently no other `TemporalAmount` implementation in this library that would make
# this generic conversion meaningful — if one is ever added (a custom type whose getUnits()
# only reports SECONDS/NANOS-compatible units), this function could become useful again.
# Until then, this function is package-private and should not be exposed as public API.
#
# + interval - The temporal amount to convert, not null.
# + return - The equivalent `Duration` instance.
function fromInterval(Period interval) returns Duration {
handle externalObj = java_time_Duration_from(interval.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Obtains a `Duration` representing an amount in the specified unit.
#
# + amount - The quantity of the temporal unit.
# + unit - The `TemporalUnit` to measure the duration in.
# + return - The created `Duration` instance.
function Duration_of(int amount, TemporalUnit unit) returns Duration {
handle externalObj = java_time_Duration_of(amount, unit.jObj);
Duration newObj = new (externalObj);
return newObj;
}
# Obtains a `Duration` representing a number of standard 24-hour days.
#
# + days - The number of days, positive or negative.
# + return - The created `Duration` instance.
public function ofDays(int days) returns Duration {
handle externalObj = java_time_Duration_ofDays(days);
Duration newObj = new (externalObj);
return newObj;
}
# Obtains a `Duration` representing a number of hours.
#
# + hours - The number of hours, positive or negative.
# + return - The created `Duration` instance.
public function ofHours(int hours) returns Duration {
handle externalObj = java_time_Duration_ofHours(hours);
Duration newObj = new (externalObj);
return newObj;
}
# Obtains a `Duration` representing a number of milliseconds.
#
# + millis - The number of milliseconds, positive or negative.
# + return - The created `Duration` instance.
public function ofMillis(int millis) returns Duration {
handle externalObj = java_time_Duration_ofMillis(millis);
Duration newObj = new (externalObj);
return newObj;
}
# Obtains a `Duration` representing a number of minutes.
#
# + minutes - The number of minutes, positive or negative.
# + return - The created `Duration` instance.
public function ofMinutes(int minutes) returns Duration {
handle externalObj = java_time_Duration_ofMinutes(minutes);
Duration newObj = new (externalObj);
return newObj;
}
# Obtains a `Duration` representing a number of nanoseconds.
#
# + nanos - The number of nanoseconds, positive or negative.
# + return - The created `Duration` instance.
public function ofNanos(int nanos) returns Duration {
handle externalObj = java_time_Duration_ofNanos(nanos);
Duration newObj = new (externalObj);
return newObj;
}
# Obtains a `Duration` representing a number of seconds.
#
# + seconds - The number of seconds, positive or negative.
# + return - The created `Duration` instance.
public function ofSeconds(int seconds) returns Duration {
handle externalObj = java_time_Duration_ofSeconds(seconds);
Duration newObj = new (externalObj);
return newObj;
}
# Obtains a `Duration` representing a number of seconds and an adjustment in nanoseconds.
#
# + seconds - The number of seconds, positive or negative.
# + nanoAdjustment - The nanosecond adjustment, from -999,999,999 to +999,999,999.
# + return - The created `Duration` instance, or an error if the arguments are invalid.
public function ofSecondsWithNanos(int seconds, int nanoAdjustment) returns Duration|error {
handle externalObj = check trap java_time_Duration_ofSeconds2(seconds, nanoAdjustment);
Duration newObj = new (externalObj);
return newObj;
}
# Obtains a `Duration` from a text string such as `PT20.345S` (ISO-8601 format).
#
# + text - The text string to parse, not null.
# + return - The parsed `Duration` instance, or an error if the text cannot be parsed.
public function parseDuration(string text) returns Duration|error {
handle externalObj = check trap java_time_Duration_parse(java:fromString(text));
Duration newObj = new (externalObj);
return newObj;
}
# Obtains a constant `Duration` instance representing a zero length.
#
# + return - The `ZERO` duration instance.
public function getZERO() returns Duration {
handle externalObj = java_time_Duration_getZERO();
Duration newObj = new (externalObj);
return newObj;
}
function java_time_Duration_abs(handle receiver) returns handle = @java:Method {
name: "abs",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_addTo(handle receiver, handle arg0) returns handle = @java:Method {
name: "addTo",
'class: "java.time.Duration",
paramTypes: ["java.time.temporal.Temporal"]
} external;
function java_time_Duration_between(handle arg0, handle arg1) returns handle|error = @java:Method {
name: "between",
'class: "java.time.Duration",
paramTypes: ["java.time.temporal.Temporal", "java.time.temporal.Temporal"]
} external;
function java_time_Duration_compareTo(handle receiver, handle arg0) returns int = @java:Method {
name: "compareTo",
'class: "java.time.Duration",
paramTypes: ["java.time.Duration"]
} external;
function java_time_Duration_dividedBy(handle receiver, handle arg0) returns int = @java:Method {
name: "dividedBy",
'class: "java.time.Duration",
paramTypes: ["java.time.Duration"]
} external;
function java_time_Duration_dividedBy2(handle receiver, int arg0) returns handle = @java:Method {
name: "dividedBy",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_equals(handle receiver, handle arg0) returns boolean = @java:Method {
name: "equals",
'class: "java.time.Duration",
paramTypes: ["java.lang.Object"]
} external;
function java_time_Duration_from(handle arg0) returns handle = @java:Method {
name: "from",
'class: "java.time.Duration",
paramTypes: ["java.time.temporal.TemporalAmount"]
} external;
function java_time_Duration_get(handle receiver, handle arg0) returns int = @java:Method {
name: "get",
'class: "java.time.Duration",
paramTypes: ["java.time.temporal.TemporalUnit"]
} external;
function java_time_Duration_getClass(handle receiver) returns handle = @java:Method {
name: "getClass",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_getNano(handle receiver) returns int = @java:Method {
name: "getNano",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_getSeconds(handle receiver) returns int = @java:Method {
name: "getSeconds",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_getUnits(handle receiver) returns handle = @java:Method {
name: "getUnits",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_hashCode(handle receiver) returns int = @java:Method {
name: "hashCode",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_isNegative(handle receiver) returns boolean = @java:Method {
name: "isNegative",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_isPositive(handle receiver) returns boolean = @java:Method {
name: "isPositive",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_isZero(handle receiver) returns boolean = @java:Method {
name: "isZero",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_minus(handle receiver, handle arg0) returns handle = @java:Method {
name: "minus",
'class: "java.time.Duration",
paramTypes: ["java.time.Duration"]
} external;
function java_time_Duration_minus2(handle receiver, int arg0, handle arg1) returns handle = @java:Method {
name: "minus",
'class: "java.time.Duration",
paramTypes: ["long", "java.time.temporal.TemporalUnit"]
} external;
function java_time_Duration_minusDays(handle receiver, int arg0) returns handle = @java:Method {
name: "minusDays",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_minusHours(handle receiver, int arg0) returns handle = @java:Method {
name: "minusHours",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_minusMillis(handle receiver, int arg0) returns handle = @java:Method {
name: "minusMillis",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_minusMinutes(handle receiver, int arg0) returns handle = @java:Method {
name: "minusMinutes",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_minusNanos(handle receiver, int arg0) returns handle = @java:Method {
name: "minusNanos",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_minusSeconds(handle receiver, int arg0) returns handle = @java:Method {
name: "minusSeconds",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_multipliedBy(handle receiver, int arg0) returns handle = @java:Method {
name: "multipliedBy",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_negated(handle receiver) returns handle = @java:Method {
name: "negated",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_notify(handle receiver) = @java:Method {
name: "notify",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_notifyAll(handle receiver) = @java:Method {
name: "notifyAll",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_of(int arg0, handle arg1) returns handle = @java:Method {
name: "of",
'class: "java.time.Duration",
paramTypes: ["long", "java.time.temporal.TemporalUnit"]
} external;
function java_time_Duration_ofDays(int arg0) returns handle = @java:Method {
name: "ofDays",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_ofHours(int arg0) returns handle = @java:Method {
name: "ofHours",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_ofMillis(int arg0) returns handle = @java:Method {
name: "ofMillis",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_ofMinutes(int arg0) returns handle = @java:Method {
name: "ofMinutes",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_ofNanos(int arg0) returns handle = @java:Method {
name: "ofNanos",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_ofSeconds(int arg0) returns handle = @java:Method {
name: "ofSeconds",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_ofSeconds2(int arg0, int arg1) returns handle|error = @java:Method {
name: "ofSeconds",
'class: "java.time.Duration",
paramTypes: ["long", "long"]
} external;
function java_time_Duration_parse(handle arg0) returns handle|error = @java:Method {
name: "parse",
'class: "java.time.Duration",
paramTypes: ["java.lang.CharSequence"]
} external;
function java_time_Duration_plus(handle receiver, handle arg0) returns handle = @java:Method {
name: "plus",
'class: "java.time.Duration",
paramTypes: ["java.time.Duration"]
} external;
function java_time_Duration_plus2(handle receiver, int arg0, handle arg1) returns handle = @java:Method {
name: "plus",
'class: "java.time.Duration",
paramTypes: ["long", "java.time.temporal.TemporalUnit"]
} external;
function java_time_Duration_plusDays(handle receiver, int arg0) returns handle = @java:Method {
name: "plusDays",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_plusHours(handle receiver, int arg0) returns handle = @java:Method {
name: "plusHours",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_plusMillis(handle receiver, int arg0) returns handle = @java:Method {
name: "plusMillis",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_plusMinutes(handle receiver, int arg0) returns handle = @java:Method {
name: "plusMinutes",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_plusNanos(handle receiver, int arg0) returns handle = @java:Method {
name: "plusNanos",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_plusSeconds(handle receiver, int arg0) returns handle = @java:Method {
name: "plusSeconds",
'class: "java.time.Duration",
paramTypes: ["long"]
} external;
function java_time_Duration_subtractFrom(handle receiver, handle arg0) returns handle = @java:Method {
name: "subtractFrom",
'class: "java.time.Duration",
paramTypes: ["java.time.temporal.Temporal"]
} external;
function java_time_Duration_toDays(handle receiver) returns int = @java:Method {
name: "toDays",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toDaysPart(handle receiver) returns int = @java:Method {
name: "toDaysPart",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toHours(handle receiver) returns int = @java:Method {
name: "toHours",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toHoursPart(handle receiver) returns int = @java:Method {
name: "toHoursPart",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toMillis(handle receiver) returns int = @java:Method {
name: "toMillis",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toMillisPart(handle receiver) returns int = @java:Method {
name: "toMillisPart",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toMinutes(handle receiver) returns int = @java:Method {
name: "toMinutes",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toMinutesPart(handle receiver) returns int = @java:Method {
name: "toMinutesPart",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toNanos(handle receiver) returns int = @java:Method {
name: "toNanos",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toNanosPart(handle receiver) returns int = @java:Method {
name: "toNanosPart",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toSeconds(handle receiver) returns int = @java:Method {
name: "toSeconds",
'class: "java.time.Duration",
paramTypes: []
} external;
function java_time_Duration_toSecondsPart(handle receiver) returns int = @java:Method {
name: "toSecondsPart",