Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
58c733a5
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
58c733a5
编写于
3月 06, 2014
作者:
S
scolebourne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8034906: Fix typos, errors and Javadoc differences in java.time
Reviewed-by: psandoz, coffeys
上级
4d1f674c
变更
36
隐藏空白更改
内联
并排
Showing
36 changed file
with
359 addition
and
345 deletion
+359
-345
src/share/classes/java/time/DayOfWeek.java
src/share/classes/java/time/DayOfWeek.java
+5
-5
src/share/classes/java/time/Duration.java
src/share/classes/java/time/Duration.java
+6
-6
src/share/classes/java/time/Instant.java
src/share/classes/java/time/Instant.java
+3
-3
src/share/classes/java/time/LocalDate.java
src/share/classes/java/time/LocalDate.java
+26
-20
src/share/classes/java/time/LocalDateTime.java
src/share/classes/java/time/LocalDateTime.java
+37
-31
src/share/classes/java/time/LocalTime.java
src/share/classes/java/time/LocalTime.java
+25
-25
src/share/classes/java/time/Month.java
src/share/classes/java/time/Month.java
+4
-4
src/share/classes/java/time/MonthDay.java
src/share/classes/java/time/MonthDay.java
+11
-11
src/share/classes/java/time/OffsetDateTime.java
src/share/classes/java/time/OffsetDateTime.java
+56
-50
src/share/classes/java/time/OffsetTime.java
src/share/classes/java/time/OffsetTime.java
+24
-24
src/share/classes/java/time/Period.java
src/share/classes/java/time/Period.java
+3
-3
src/share/classes/java/time/Year.java
src/share/classes/java/time/Year.java
+18
-18
src/share/classes/java/time/YearMonth.java
src/share/classes/java/time/YearMonth.java
+15
-16
src/share/classes/java/time/ZoneId.java
src/share/classes/java/time/ZoneId.java
+2
-2
src/share/classes/java/time/ZoneOffset.java
src/share/classes/java/time/ZoneOffset.java
+5
-5
src/share/classes/java/time/ZonedDateTime.java
src/share/classes/java/time/ZonedDateTime.java
+35
-34
src/share/classes/java/time/chrono/ChronoLocalDate.java
src/share/classes/java/time/chrono/ChronoLocalDate.java
+2
-2
src/share/classes/java/time/chrono/ChronoLocalDateImpl.java
src/share/classes/java/time/chrono/ChronoLocalDateImpl.java
+7
-7
src/share/classes/java/time/chrono/ChronoLocalDateTime.java
src/share/classes/java/time/chrono/ChronoLocalDateTime.java
+2
-3
src/share/classes/java/time/chrono/ChronoZonedDateTime.java
src/share/classes/java/time/chrono/ChronoZonedDateTime.java
+4
-5
src/share/classes/java/time/chrono/Chronology.java
src/share/classes/java/time/chrono/Chronology.java
+7
-6
src/share/classes/java/time/chrono/Era.java
src/share/classes/java/time/chrono/Era.java
+3
-3
src/share/classes/java/time/chrono/HijrahChronology.java
src/share/classes/java/time/chrono/HijrahChronology.java
+3
-3
src/share/classes/java/time/chrono/IsoChronology.java
src/share/classes/java/time/chrono/IsoChronology.java
+3
-3
src/share/classes/java/time/chrono/JapaneseChronology.java
src/share/classes/java/time/chrono/JapaneseChronology.java
+3
-3
src/share/classes/java/time/chrono/MinguoChronology.java
src/share/classes/java/time/chrono/MinguoChronology.java
+3
-3
src/share/classes/java/time/chrono/ThaiBuddhistChronology.java
...hare/classes/java/time/chrono/ThaiBuddhistChronology.java
+3
-3
src/share/classes/java/time/format/DateTimeFormatter.java
src/share/classes/java/time/format/DateTimeFormatter.java
+4
-4
src/share/classes/java/time/format/DateTimeFormatterBuilder.java
...re/classes/java/time/format/DateTimeFormatterBuilder.java
+15
-18
src/share/classes/java/time/format/DecimalStyle.java
src/share/classes/java/time/format/DecimalStyle.java
+4
-5
src/share/classes/java/time/temporal/IsoFields.java
src/share/classes/java/time/temporal/IsoFields.java
+2
-2
src/share/classes/java/time/temporal/Temporal.java
src/share/classes/java/time/temporal/Temporal.java
+7
-6
src/share/classes/java/time/temporal/TemporalAccessor.java
src/share/classes/java/time/temporal/TemporalAccessor.java
+3
-3
src/share/classes/java/time/temporal/TemporalField.java
src/share/classes/java/time/temporal/TemporalField.java
+4
-4
src/share/classes/java/time/temporal/TemporalUnit.java
src/share/classes/java/time/temporal/TemporalUnit.java
+2
-2
src/share/classes/java/time/zone/ZoneOffsetTransition.java
src/share/classes/java/time/zone/ZoneOffsetTransition.java
+3
-3
未找到文件。
src/share/classes/java/time/DayOfWeek.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -201,7 +201,7 @@ public enum DayOfWeek implements TemporalAccessor, TemporalAdjuster {
* Gets the day-of-week {@code int} value.
* <p>
* The values are numbered following the ISO-8601 standard, from 1 (Monday) to 7 (Sunday).
* See {@link
WeekFields#dayOfWeek
} for localized week-numbering.
* See {@link
java.time.temporal.WeekFields#dayOfWeek()
} for localized week-numbering.
*
* @return the day-of-week, from 1 (Monday) to 7 (Sunday)
*/
...
...
@@ -288,7 +288,7 @@ public enum DayOfWeek implements TemporalAccessor, TemporalAdjuster {
/**
* Gets the value of the specified field from this day-of-week as an {@code int}.
* <p>
* This queries this day-of-week for the value
for
the specified field.
* This queries this day-of-week for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -321,7 +321,7 @@ public enum DayOfWeek implements TemporalAccessor, TemporalAdjuster {
/**
* Gets the value of the specified field from this day-of-week as a {@code long}.
* <p>
* This queries this day-of-week for the value
for
the specified field.
* This queries this day-of-week for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
@@ -419,7 +419,7 @@ public enum DayOfWeek implements TemporalAccessor, TemporalAdjuster {
* The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)}
* passing {@link ChronoField#DAY_OF_WEEK} as the field.
* Note that this adjusts forwards or backwards within a Monday to Sunday week.
* See {@link
WeekFields#dayOfWeek
} for localized week start days.
* See {@link
java.time.temporal.WeekFields#dayOfWeek()
} for localized week start days.
* See {@code TemporalAdjuster} for other adjusters with more control,
* such as {@code next(MONDAY)}.
* <p>
...
...
src/share/classes/java/time/Duration.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -546,7 +546,7 @@ public final class Duration
* They are returned in the order seconds, nanos.
* <p>
* This set can be used in conjunction with {@link #get(TemporalUnit)}
* to access the entire state of the
period
.
* to access the entire state of the
duration
.
*
* @return a list containing the seconds and nanos units, not null
*/
...
...
@@ -686,8 +686,8 @@ public final class Duration
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param amountToAdd the amount
of the perio
d, measured in terms of the unit, positive or negative
* @param unit the unit that the
period
is measured in, must have an exact duration, not null
* @param amountToAdd the amount
to ad
d, measured in terms of the unit, positive or negative
* @param unit the unit that the
amount
is measured in, must have an exact duration, not null
* @return a {@code Duration} based on this duration with the specified duration added, not null
* @throws UnsupportedTemporalTypeException if the unit is not supported
* @throws ArithmeticException if numeric overflow occurs
...
...
@@ -848,8 +848,8 @@ public final class Duration
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param amountToSubtract the amount
of the period
, measured in terms of the unit, positive or negative
* @param unit the unit that the
period
is measured in, must have an exact duration, not null
* @param amountToSubtract the amount
to subtract
, measured in terms of the unit, positive or negative
* @param unit the unit that the
amount
is measured in, must have an exact duration, not null
* @return a {@code Duration} based on this duration with the specified duration subtracted, not null
* @throws ArithmeticException if numeric overflow occurs
*/
...
...
src/share/classes/java/time/Instant.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -530,7 +530,7 @@ public final class Instant
/**
* Gets the value of the specified field from this instant as an {@code int}.
* <p>
* This queries this instant for the value
for
the specified field.
* This queries this instant for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -571,7 +571,7 @@ public final class Instant
/**
* Gets the value of the specified field from this instant as a {@code long}.
* <p>
* This queries this instant for the value
for
the specified field.
* This queries this instant for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
src/share/classes/java/time/LocalDate.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -280,7 +280,7 @@ public final class LocalDate
* @param dayOfYear the day-of-year to represent, from 1 to 366
* @return the local date, not null
* @throws DateTimeException if the value of any field is out of range,
* or if the day-of-year is invalid for the
month-
year
* or if the day-of-year is invalid for the year
*/
public
static
LocalDate
ofYearDay
(
int
year
,
int
dayOfYear
)
{
YEAR
.
checkValidValue
(
year
);
...
...
@@ -308,7 +308,7 @@ public final class LocalDate
*
* @param epochDay the Epoch Day to convert, based on the epoch 1970-01-01
* @return the local date, not null
* @throws DateTimeException if the epoch day
s
exceeds the supported date range
* @throws DateTimeException if the epoch day exceeds the supported date range
*/
public
static
LocalDate
ofEpochDay
(
long
epochDay
)
{
long
zeroDay
=
epochDay
+
DAYS_0000_TO_1970
;
...
...
@@ -515,7 +515,7 @@ public final class LocalDate
/**
* Checks if the specified unit is supported.
* <p>
* This checks if the specified unit can be added to, or subtracted from, this date
-time
.
* This checks if the specified unit can be added to, or subtracted from, this date.
* If false, then calling the {@link #plus(long, TemporalUnit)} and
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
* <p>
...
...
@@ -592,7 +592,7 @@ public final class LocalDate
/**
* Gets the value of the specified field from this date as an {@code int}.
* <p>
* This queries this date for the value
for
the specified field.
* This queries this date for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -627,7 +627,7 @@ public final class LocalDate
/**
* Gets the value of the specified field from this date as a {@code long}.
* <p>
* This queries this date for the value
for
the specified field.
* This queries this date for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
@@ -875,7 +875,9 @@ public final class LocalDate
* <p>
* A simple adjuster might simply set the one of the fields, such as the year field.
* A more complex adjuster might set the date to the last day of the month.
* A selection of common adjustments is provided in {@link TemporalAdjuster}.
* <p>
* A selection of common adjustments is provided in
* {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
* These include finding the "last day of the month" and "next Wednesday".
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
...
...
@@ -885,7 +887,7 @@ public final class LocalDate
* For example this code returns a date on the last day of July:
* <pre>
* import static java.time.Month.*;
* import static java.time.temporal.Adjusters.*;
* import static java.time.temporal.
Temporal
Adjusters.*;
*
* result = localDate.with(JULY).with(lastDayOfMonth());
* </pre>
...
...
@@ -1041,7 +1043,8 @@ public final class LocalDate
//-----------------------------------------------------------------------
/**
* Returns a copy of this date with the year altered.
* Returns a copy of this {@code LocalDate} with the year altered.
* <p>
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
* This instance is immutable and unaffected by this method call.
...
...
@@ -1059,7 +1062,8 @@ public final class LocalDate
}
/**
* Returns a copy of this date with the month-of-year altered.
* Returns a copy of this {@code LocalDate} with the month-of-year altered.
* <p>
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
* This instance is immutable and unaffected by this method call.
...
...
@@ -1077,7 +1081,8 @@ public final class LocalDate
}
/**
* Returns a copy of this date with the day-of-month altered.
* Returns a copy of this {@code LocalDate} with the day-of-month altered.
* <p>
* If the resulting date is invalid, an exception is thrown.
* <p>
* This instance is immutable and unaffected by this method call.
...
...
@@ -1095,7 +1100,8 @@ public final class LocalDate
}
/**
* Returns a copy of this date with the day-of-year altered.
* Returns a copy of this {@code LocalDate} with the day-of-year altered.
* <p>
* If the resulting date is invalid, an exception is thrown.
* <p>
* This instance is immutable and unaffected by this method call.
...
...
@@ -1245,7 +1251,7 @@ public final class LocalDate
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalDate} with the specified
period in
years added.
* Returns a copy of this {@code LocalDate} with the specified
number of
years added.
* <p>
* This method adds the specified amount to the years field in three steps:
* <ol>
...
...
@@ -1273,7 +1279,7 @@ public final class LocalDate
}
/**
* Returns a copy of this {@code LocalDate} with the specified
period in
months added.
* Returns a copy of this {@code LocalDate} with the specified
number of
months added.
* <p>
* This method adds the specified amount to the months field in three steps:
* <ol>
...
...
@@ -1304,7 +1310,7 @@ public final class LocalDate
}
/**
* Returns a copy of this {@code LocalDate} with the specified
period in
weeks added.
* Returns a copy of this {@code LocalDate} with the specified
number of
weeks added.
* <p>
* This method adds the specified amount in weeks to the days field incrementing
* the month and year fields as necessary to ensure the result remains valid.
...
...
@@ -1402,11 +1408,11 @@ public final class LocalDate
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalDate} with the specified
period in
years subtracted.
* Returns a copy of this {@code LocalDate} with the specified
number of
years subtracted.
* <p>
* This method subtracts the specified amount from the years field in three steps:
* <ol>
* <li>Subtract the input years
to
the year field</li>
* <li>Subtract the input years
from
the year field</li>
* <li>Check if the resulting date would be invalid</li>
* <li>Adjust the day-of-month to the last valid day if necessary</li>
* </ol>
...
...
@@ -1426,11 +1432,11 @@ public final class LocalDate
}
/**
* Returns a copy of this {@code LocalDate} with the specified
period in
months subtracted.
* Returns a copy of this {@code LocalDate} with the specified
number of
months subtracted.
* <p>
* This method subtracts the specified amount from the months field in three steps:
* <ol>
* <li>Subtract the input months
to
the month-of-year field</li>
* <li>Subtract the input months
from
the month-of-year field</li>
* <li>Check if the resulting date would be invalid</li>
* <li>Adjust the day-of-month to the last valid day if necessary</li>
* </ol>
...
...
@@ -1450,7 +1456,7 @@ public final class LocalDate
}
/**
* Returns a copy of this {@code LocalDate} with the specified
period in
weeks subtracted.
* Returns a copy of this {@code LocalDate} with the specified
number of
weeks subtracted.
* <p>
* This method subtracts the specified amount in weeks from the days field decrementing
* the month and year fields as necessary to ensure the result remains valid.
...
...
src/share/classes/java/time/LocalDateTime.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -428,7 +428,7 @@ public final class LocalDateTime
/**
* Obtains an instance of {@code LocalDateTime} from a temporal object.
* <p>
* This obtains a
n offset
time based on the specified temporal.
* This obtains a
local date-
time based on the specified temporal.
* A {@code TemporalAccessor} represents an arbitrary set of date and time information,
* which this factory converts to an instance of {@code LocalDateTime}.
* <p>
...
...
@@ -656,7 +656,7 @@ public final class LocalDateTime
/**
* Gets the value of the specified field from this date-time as an {@code int}.
* <p>
* This queries this date-time for the value
for
the specified field.
* This queries this date-time for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -693,7 +693,7 @@ public final class LocalDateTime
/**
* Gets the value of the specified field from this date-time as a {@code long}.
* <p>
* This queries this date-time for the value
for
the specified field.
* This queries this date-time for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
@@ -878,7 +878,9 @@ public final class LocalDateTime
* <p>
* A simple adjuster might simply set the one of the fields, such as the year field.
* A more complex adjuster might set the date to the last day of the month.
* A selection of common adjustments is provided in {@link TemporalAdjuster}.
* <p>
* A selection of common adjustments is provided in
* {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
* These include finding the "last day of the month" and "next Wednesday".
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
...
...
@@ -888,7 +890,7 @@ public final class LocalDateTime
* For example this code returns a date on the last day of July:
* <pre>
* import static java.time.Month.*;
* import static java.time.temporal.Adjusters.*;
* import static java.time.temporal.
Temporal
Adjusters.*;
*
* result = localDateTime.with(JULY).with(lastDayOfMonth());
* </pre>
...
...
@@ -974,6 +976,7 @@ public final class LocalDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalDateTime} with the year altered.
* <p>
* The time does not affect the calculation and will be the same in the result.
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
...
...
@@ -989,6 +992,7 @@ public final class LocalDateTime
/**
* Returns a copy of this {@code LocalDateTime} with the month-of-year altered.
* <p>
* The time does not affect the calculation and will be the same in the result.
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
...
...
@@ -1004,7 +1008,8 @@ public final class LocalDateTime
/**
* Returns a copy of this {@code LocalDateTime} with the day-of-month altered.
* If the resulting {@code LocalDateTime} is invalid, an exception is thrown.
* <p>
* If the resulting date-time is invalid, an exception is thrown.
* The time does not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
...
...
@@ -1020,7 +1025,8 @@ public final class LocalDateTime
/**
* Returns a copy of this {@code LocalDateTime} with the day-of-year altered.
* If the resulting {@code LocalDateTime} is invalid, an exception is thrown.
* <p>
* If the resulting date-time is invalid, an exception is thrown.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1035,7 +1041,7 @@ public final class LocalDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalDateTime} with the hour-of-day
value
altered.
* Returns a copy of this {@code LocalDateTime} with the hour-of-day altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1049,7 +1055,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the minute-of-hour
value
altered.
* Returns a copy of this {@code LocalDateTime} with the minute-of-hour altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1063,7 +1069,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the second-of-minute
value
altered.
* Returns a copy of this {@code LocalDateTime} with the second-of-minute altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1077,7 +1083,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the nano-of-second
value
altered.
* Returns a copy of this {@code LocalDateTime} with the nano-of-second altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1109,7 +1115,7 @@ public final class LocalDateTime
* @param unit the unit to truncate to, not null
* @return a {@code LocalDateTime} based on this date-time with the time truncated, not null
* @throws DateTimeException if unable to truncate
* @throws UnsupportedTemporalTypeException if the
field
is not supported
* @throws UnsupportedTemporalTypeException if the
unit
is not supported
*/
public
LocalDateTime
truncatedTo
(
TemporalUnit
unit
)
{
return
with
(
date
,
time
.
truncatedTo
(
unit
));
...
...
@@ -1192,7 +1198,7 @@ public final class LocalDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
years added.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
years added.
* <p>
* This method adds the specified amount to the years field in three steps:
* <ol>
...
...
@@ -1217,7 +1223,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
months added.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
months added.
* <p>
* This method adds the specified amount to the months field in three steps:
* <ol>
...
...
@@ -1242,7 +1248,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
weeks added.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
weeks added.
* <p>
* This method adds the specified amount in weeks to the days field incrementing
* the month and year fields as necessary to ensure the result remains valid.
...
...
@@ -1262,7 +1268,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
days added.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
days added.
* <p>
* This method adds the specified amount to the days field incrementing the
* month and year fields as necessary to ensure the result remains valid.
...
...
@@ -1283,7 +1289,7 @@ public final class LocalDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
hours added.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
hours added.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1296,7 +1302,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
minutes added.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
minutes added.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1309,7 +1315,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
seconds added.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
seconds added.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1322,7 +1328,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
nanoseconds added.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
nanoseconds added.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1391,7 +1397,7 @@ public final class LocalDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
years subtracted.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
years subtracted.
* <p>
* This method subtracts the specified amount from the years field in three steps:
* <ol>
...
...
@@ -1415,7 +1421,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
months subtracted.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
months subtracted.
* <p>
* This method subtracts the specified amount from the months field in three steps:
* <ol>
...
...
@@ -1439,7 +1445,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
weeks subtracted.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
weeks subtracted.
* <p>
* This method subtracts the specified amount in weeks from the days field decrementing
* the month and year fields as necessary to ensure the result remains valid.
...
...
@@ -1458,9 +1464,9 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
days subtracted.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
days subtracted.
* <p>
* This method subtracts the specified amount from the days field
in
crementing the
* This method subtracts the specified amount from the days field
de
crementing the
* month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
...
...
@@ -1478,7 +1484,7 @@ public final class LocalDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
hours subtracted.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
hours subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1491,7 +1497,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
minutes subtracted.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
minutes subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1504,7 +1510,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
seconds subtracted.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
seconds subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1517,7 +1523,7 @@ public final class LocalDateTime
}
/**
* Returns a copy of this {@code LocalDateTime} with the specified
period in
nanoseconds subtracted.
* Returns a copy of this {@code LocalDateTime} with the specified
number of
nanoseconds subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1575,7 +1581,7 @@ public final class LocalDateTime
* what the result of this method will be.
* <p>
* The result of this method is obtained by invoking the
* {@link
java.time.temporal.
TemporalQuery#queryFrom(TemporalAccessor)} method on the
* {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
* specified query passing {@code this} as the argument.
*
* @param <R> the type of the result
...
...
src/share/classes/java/time/LocalTime.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -93,7 +93,7 @@ import java.time.temporal.ValueRange;
import
java.util.Objects
;
/**
* A time without time-zone in the ISO-8601 calendar system,
* A time without
a
time-zone in the ISO-8601 calendar system,
* such as {@code 10:15:30}.
* <p>
* {@code LocalTime} is an immutable date-time object that represents a time,
...
...
@@ -101,7 +101,7 @@ import java.util.Objects;
* Time is represented to nanosecond precision.
* For example, the value "13:45.30.123456789" can be stored in a {@code LocalTime}.
* <p>
*
It
does not store or represent a date or time-zone.
*
This class
does not store or represent a date or time-zone.
* Instead, it is a description of the local time as seen on a wall clock.
* It cannot represent an instant on the time-line without additional information
* such as an offset or time-zone.
...
...
@@ -280,7 +280,7 @@ public final class LocalTime
return
ofNanoOfDay
(
secsOfDay
*
NANOS_PER_SECOND
+
now
.
getNano
());
}
//------------------------
get
-----------------------------------------------
//-----------------------------------------------------------------------
/**
* Obtains an instance of {@code LocalTime} from an hour and minute.
* <p>
...
...
@@ -395,7 +395,7 @@ public final class LocalTime
* on extracting the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} field.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code LocalTime::from}.
* allowing it to be used
as a query
via method reference, {@code LocalTime::from}.
*
* @param temporal the temporal object to convert, not null
* @return the local time, not null
...
...
@@ -418,7 +418,7 @@ public final class LocalTime
* The string must represent a valid time and is parsed using
* {@link java.time.format.DateTimeFormatter#ISO_LOCAL_TIME}.
*
* @param text the text to parse such as "10:15:30", not null
* @param text
the text to parse such as "10:15:30", not null
* @return the parsed local time, not null
* @throws DateTimeParseException if the text cannot be parsed
*/
...
...
@@ -524,7 +524,7 @@ public final class LocalTime
/**
* Checks if the specified unit is supported.
* <p>
* This checks if the specified unit can be added to, or subtracted from, this
date-
time.
* This checks if the specified unit can be added to, or subtracted from, this time.
* If false, then calling the {@link #plus(long, TemporalUnit)} and
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
* <p>
...
...
@@ -589,7 +589,7 @@ public final class LocalTime
/**
* Gets the value of the specified field from this time as an {@code int}.
* <p>
* This queries this time for the value
for
the specified field.
* This queries this time for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -624,7 +624,7 @@ public final class LocalTime
/**
* Gets the value of the specified field from this time as a {@code long}.
* <p>
* This queries this time for the value
for
the specified field.
* This queries this time for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
@@ -858,7 +858,7 @@ public final class LocalTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalTime} with the hour-of-day
value
altered.
* Returns a copy of this {@code LocalTime} with the hour-of-day altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -875,7 +875,7 @@ public final class LocalTime
}
/**
* Returns a copy of this {@code LocalTime} with the minute-of-hour
value
altered.
* Returns a copy of this {@code LocalTime} with the minute-of-hour altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -892,7 +892,7 @@ public final class LocalTime
}
/**
* Returns a copy of this {@code LocalTime} with the second-of-minute
value
altered.
* Returns a copy of this {@code LocalTime} with the second-of-minute altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -909,7 +909,7 @@ public final class LocalTime
}
/**
* Returns a copy of this {@code LocalTime} with the nano-of-second
value
altered.
* Returns a copy of this {@code LocalTime} with the nano-of-second altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -929,7 +929,7 @@ public final class LocalTime
/**
* Returns a copy of this {@code LocalTime} with the time truncated.
* <p>
* Truncati
ng the time
returns a copy of the original time with fields
* Truncati
on
returns a copy of the original time with fields
* smaller than the specified unit set to zero.
* For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit
* will set the second-of-minute and nano-of-second field to zero.
...
...
@@ -1059,7 +1059,7 @@ public final class LocalTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalTime} with the specified
period in
hours added.
* Returns a copy of this {@code LocalTime} with the specified
number of
hours added.
* <p>
* This adds the specified number of hours to this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1078,7 +1078,7 @@ public final class LocalTime
}
/**
* Returns a copy of this {@code LocalTime} with the specified
period in
minutes added.
* Returns a copy of this {@code LocalTime} with the specified
number of
minutes added.
* <p>
* This adds the specified number of minutes to this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1103,7 +1103,7 @@ public final class LocalTime
}
/**
* Returns a copy of this {@code LocalTime} with the specified
period in
seconds added.
* Returns a copy of this {@code LocalTime} with the specified
number of
seconds added.
* <p>
* This adds the specified number of seconds to this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1130,7 +1130,7 @@ public final class LocalTime
}
/**
* Returns a copy of this {@code LocalTime} with the specified
period in
nanoseconds added.
* Returns a copy of this {@code LocalTime} with the specified
number of
nanoseconds added.
* <p>
* This adds the specified number of nanoseconds to this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1208,7 +1208,7 @@ public final class LocalTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalTime} with the specified
period in
hours subtracted.
* Returns a copy of this {@code LocalTime} with the specified
number of
hours subtracted.
* <p>
* This subtracts the specified number of hours from this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1223,7 +1223,7 @@ public final class LocalTime
}
/**
* Returns a copy of this {@code LocalTime} with the specified
period in
minutes subtracted.
* Returns a copy of this {@code LocalTime} with the specified
number of
minutes subtracted.
* <p>
* This subtracts the specified number of minutes from this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1238,7 +1238,7 @@ public final class LocalTime
}
/**
* Returns a copy of this {@code LocalTime} with the specified
period in
seconds subtracted.
* Returns a copy of this {@code LocalTime} with the specified
number of
seconds subtracted.
* <p>
* This subtracts the specified number of seconds from this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1253,7 +1253,7 @@ public final class LocalTime
}
/**
* Returns a copy of this {@code LocalTime} with the specified
period in
nanoseconds subtracted.
* Returns a copy of this {@code LocalTime} with the specified
number of
nanoseconds subtracted.
* <p>
* This subtracts the specified number of nanoseconds from this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1470,7 +1470,7 @@ public final class LocalTime
//-----------------------------------------------------------------------
/**
* Compares this
{@code LocalTime}
to another time.
* Compares this
time
to another time.
* <p>
* The comparison is based on the time-line position of the local times within a day.
* It is "consistent with equals", as defined by {@link Comparable}.
...
...
@@ -1495,7 +1495,7 @@ public final class LocalTime
}
/**
* Checks if this
{@code LocalTime}
is after the specified time.
* Checks if this
time
is after the specified time.
* <p>
* The comparison is based on the time-line position of the time within a day.
*
...
...
@@ -1508,7 +1508,7 @@ public final class LocalTime
}
/**
* Checks if this
{@code LocalTime}
is before the specified time.
* Checks if this
time
is before the specified time.
* <p>
* The comparison is based on the time-line position of the time within a day.
*
...
...
src/share/classes/java/time/Month.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -202,7 +202,7 @@ public enum Month implements TemporalAccessor, TemporalAdjuster {
* chronology, or can be converted to a {@code LocalDate}.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code Month::from}.
* allowing it to be used
as a query
via method reference, {@code Month::from}.
*
* @param temporal the temporal object to convert, not null
* @return the month-of-year, not null
...
...
@@ -315,7 +315,7 @@ public enum Month implements TemporalAccessor, TemporalAdjuster {
/**
* Gets the value of the specified field from this month-of-year as an {@code int}.
* <p>
* This queries this month for the value
for
the specified field.
* This queries this month for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -348,7 +348,7 @@ public enum Month implements TemporalAccessor, TemporalAdjuster {
/**
* Gets the value of the specified field from this month-of-year as a {@code long}.
* <p>
* This queries this month for the value
for
the specified field.
* This queries this month for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
src/share/classes/java/time/MonthDay.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -90,8 +90,8 @@ import java.util.Objects;
* A month-day in the ISO-8601 calendar system, such as {@code --12-03}.
* <p>
* {@code MonthDay} is an immutable date-time object that represents the combination
* of a
year and month. Any field that can be derived from a month and day, such as
* quarter-of-year, can be obtained.
* of a
month and day-of-month. Any field that can be derived from a month and day,
*
such as
quarter-of-year, can be obtained.
* <p>
* This class does not store or represent a year, time or time-zone.
* For example, the value "December 3rd" can be stored in a {@code MonthDay}.
...
...
@@ -154,7 +154,7 @@ public final class MonthDay
/**
* Obtains the current month-day from the system clock in the default time-zone.
* <p>
* This will query the {@link
java.time.
Clock#systemDefaultZone() system clock} in the default
* This will query the {@link Clock#systemDefaultZone() system clock} in the default
* time-zone to obtain the current month-day.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
...
...
@@ -169,7 +169,7 @@ public final class MonthDay
/**
* Obtains the current month-day from the system clock in the specified time-zone.
* <p>
* This will query the {@link Clock#system(
java.time.
ZoneId) system clock} to obtain the current month-day.
* This will query the {@link Clock#system(ZoneId) system clock} to obtain the current month-day.
* Specifying the time-zone avoids dependence on the default time-zone.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
...
...
@@ -258,7 +258,7 @@ public final class MonthDay
* chronology, or can be converted to a {@code LocalDate}.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code MonthDay::from}.
* allowing it to be used
as a query
via method reference, {@code MonthDay::from}.
*
* @param temporal the temporal object to convert, not null
* @return the month-day, not null
...
...
@@ -389,7 +389,7 @@ public final class MonthDay
/**
* Gets the value of the specified field from this month-day as an {@code int}.
* <p>
* This queries this month-day for the value
for
the specified field.
* This queries this month-day for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -420,7 +420,7 @@ public final class MonthDay
/**
* Gets the value of the specified field from this month-day as a {@code long}.
* <p>
* This queries this month-day for the value
for
the specified field.
* This queries this month-day for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
@@ -501,7 +501,7 @@ public final class MonthDay
* This method checks whether this month and day and the input year form
* a valid date. This can only return false for February 29th.
*
* @param year the year to validate
, an out of range value returns false
* @param year the year to validate
* @return true if the year is valid for this month-day
* @see Year#isValidMonthDay(MonthDay)
*/
...
...
@@ -685,7 +685,7 @@ public final class MonthDay
}
/**
*
Is this month-day
after the specified month-day.
*
Checks if this month-day is
after the specified month-day.
*
* @param other the other month-day to compare to, not null
* @return true if this is after the specified month-day
...
...
@@ -695,7 +695,7 @@ public final class MonthDay
}
/**
*
Is this month-day
before the specified month-day.
*
Checks if this month-day is
before the specified month-day.
*
* @param other the other month-day to compare to, not null
* @return true if this point is before the specified month-day
...
...
src/share/classes/java/time/OffsetDateTime.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -199,7 +199,7 @@ public final class OffsetDateTime
/**
* Obtains the current date-time from the system clock in the default time-zone.
* <p>
* This will query the {@link
java.time.
Clock#systemDefaultZone() system clock} in the default
* This will query the {@link Clock#systemDefaultZone() system clock} in the default
* time-zone to obtain the current date-time.
* The offset will be calculated from the time-zone in the clock.
* <p>
...
...
@@ -215,7 +215,7 @@ public final class OffsetDateTime
/**
* Obtains the current date-time from the system clock in the specified time-zone.
* <p>
* This will query the {@link Clock#system(
java.time.
ZoneId) system clock} to obtain the current date-time.
* This will query the {@link Clock#system(ZoneId) system clock} to obtain the current date-time.
* Specifying the time-zone avoids dependence on the default time-zone.
* The offset will be calculated from the specified time-zone.
* <p>
...
...
@@ -345,7 +345,7 @@ public final class OffsetDateTime
* those fields that are equivalent to the relevant objects.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code OffsetDateTime::from}.
* allowing it to be used
as a query
via method reference, {@code OffsetDateTime::from}.
*
* @param temporal the temporal object to convert, not null
* @return the offset date-time, not null
...
...
@@ -567,7 +567,7 @@ public final class OffsetDateTime
/**
* Gets the value of the specified field from this date-time as an {@code int}.
* <p>
* This queries this date-time for the value
for
the specified field.
* This queries this date-time for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -609,7 +609,7 @@ public final class OffsetDateTime
/**
* Gets the value of the specified field from this date-time as a {@code long}.
* <p>
* This queries this date-time for the value
for
the specified field.
* This queries this date-time for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
@@ -704,7 +704,7 @@ public final class OffsetDateTime
//-----------------------------------------------------------------------
/**
* Gets the {@code LocalDateTime} part of this
offset
date-time.
* Gets the {@code LocalDateTime} part of this date-time.
* <p>
* This returns a {@code LocalDateTime} with the same year, month, day and time
* as this date-time.
...
...
@@ -796,10 +796,10 @@ public final class OffsetDateTime
/**
* Gets the day-of-week field, which is an enum {@code DayOfWeek}.
* <p>
* This method returns the enum {@link
java.time.
DayOfWeek} for the day-of-week.
* This method returns the enum {@link DayOfWeek} for the day-of-week.
* This avoids confusion as to what {@code int} values mean.
* If you need access to the primitive {@code int} value then the enum
* provides the {@link
java.time.
DayOfWeek#getValue() int value}.
* provides the {@link DayOfWeek#getValue() int value}.
* <p>
* Additional information can be obtained from the {@code DayOfWeek}.
* This includes textual names of the values.
...
...
@@ -869,7 +869,8 @@ public final class OffsetDateTime
* <p>
* A simple adjuster might simply set the one of the fields, such as the year field.
* A more complex adjuster might set the date to the last day of the month.
* A selection of common adjustments is provided in {@link TemporalAdjuster}.
* A selection of common adjustments is provided in
* {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
* These include finding the "last day of the month" and "next Wednesday".
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
...
...
@@ -879,7 +880,7 @@ public final class OffsetDateTime
* For example this code returns a date on the last day of July:
* <pre>
* import static java.time.Month.*;
* import static java.time.temporal.Adjusters.*;
* import static java.time.temporal.
Temporal
Adjusters.*;
*
* result = offsetDateTime.with(JULY).with(lastDayOfMonth());
* </pre>
...
...
@@ -921,7 +922,7 @@ public final class OffsetDateTime
/**
* Returns a copy of this date-time with the specified field set to a new value.
* <p>
* T
T
his returns an {@code OffsetDateTime}, based on this one, with the value
* This returns an {@code OffsetDateTime}, based on this one, with the value
* for the specified field changed.
* This can be used to change any supported field, such as the year, month or day-of-month.
* If it is not possible to set the value, because the field is not supported or for
...
...
@@ -980,7 +981,8 @@ public final class OffsetDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code OffsetDateTime} with the year altered.
* The offset does not affect the calculation and will be the same in the result.
* <p>
* The time and offset do not affect the calculation and will be the same in the result.
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
* This instance is immutable and unaffected by this method call.
...
...
@@ -995,7 +997,8 @@ public final class OffsetDateTime
/**
* Returns a copy of this {@code OffsetDateTime} with the month-of-year altered.
* The offset does not affect the calculation and will be the same in the result.
* <p>
* The time and offset do not affect the calculation and will be the same in the result.
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
* This instance is immutable and unaffected by this method call.
...
...
@@ -1010,8 +1013,9 @@ public final class OffsetDateTime
/**
* Returns a copy of this {@code OffsetDateTime} with the day-of-month altered.
* <p>
* If the resulting {@code OffsetDateTime} is invalid, an exception is thrown.
* The
offset does
not affect the calculation and will be the same in the result.
* The
time and offset do
not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1026,6 +1030,8 @@ public final class OffsetDateTime
/**
* Returns a copy of this {@code OffsetDateTime} with the day-of-year altered.
* <p>
* The time and offset do not affect the calculation and will be the same in the result.
* If the resulting {@code OffsetDateTime} is invalid, an exception is thrown.
* <p>
* This instance is immutable and unaffected by this method call.
...
...
@@ -1041,9 +1047,9 @@ public final class OffsetDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code OffsetDateTime} with the hour-of-day
value
altered.
* Returns a copy of this {@code OffsetDateTime} with the hour-of-day altered.
* <p>
* The
offset does
not affect the calculation and will be the same in the result.
* The
date and offset do
not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1056,9 +1062,9 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the minute-of-hour
value
altered.
* Returns a copy of this {@code OffsetDateTime} with the minute-of-hour altered.
* <p>
* The
offset does
not affect the calculation and will be the same in the result.
* The
date and offset do
not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1071,9 +1077,9 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the second-of-minute
value
altered.
* Returns a copy of this {@code OffsetDateTime} with the second-of-minute altered.
* <p>
* The
offset does
not affect the calculation and will be the same in the result.
* The
date and offset do
not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1086,15 +1092,15 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the nano-of-second
value
altered.
* Returns a copy of this {@code OffsetDateTime} with the nano-of-second altered.
* <p>
* The
offset does
not affect the calculation and will be the same in the result.
* The
date and offset do
not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999
* @return an {@code OffsetDateTime} based on this date-time with the requested nanosecond, not null
* @throws DateTimeException if the nano
s
value is invalid
* @throws DateTimeException if the nano value is invalid
*/
public
OffsetDateTime
withNano
(
int
nanoOfSecond
)
{
return
with
(
dateTime
.
withNano
(
nanoOfSecond
),
offset
);
...
...
@@ -1188,7 +1194,7 @@ public final class OffsetDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
years added.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
years added.
* <p>
* This method adds the specified amount to the years field in three steps:
* <ol>
...
...
@@ -1212,7 +1218,7 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
months added.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
months added.
* <p>
* This method adds the specified amount to the months field in three steps:
* <ol>
...
...
@@ -1236,13 +1242,13 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this OffsetDateTime with the specified
period in
weeks added.
* Returns a copy of this OffsetDateTime with the specified
number of
weeks added.
* <p>
* This method adds the specified amount in weeks to the days field incrementing
* the month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
* For example, 2008-12-31 plus one week would result in
the
2009-01-07.
* For example, 2008-12-31 plus one week would result in 2009-01-07.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1255,13 +1261,13 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this OffsetDateTime with the specified
period in
days added.
* Returns a copy of this OffsetDateTime with the specified
number of
days added.
* <p>
* This method adds the specified amount to the days field incrementing the
* month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
* For example, 2008-12-31 plus one day would result in
the
2009-01-01.
* For example, 2008-12-31 plus one day would result in 2009-01-01.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1274,7 +1280,7 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
hours added.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
hours added.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1287,7 +1293,7 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
minutes added.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
minutes added.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1300,7 +1306,7 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
seconds added.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
seconds added.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1313,7 +1319,7 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
nanoseconds added.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
nanoseconds added.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1377,11 +1383,11 @@ public final class OffsetDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
years subtracted.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
years subtracted.
* <p>
* This method subtracts the specified amount from the years field in three steps:
* <ol>
* <li>Subtract the input years
to
the year field</li>
* <li>Subtract the input years
from
the year field</li>
* <li>Check if the resulting date would be invalid</li>
* <li>Adjust the day-of-month to the last valid day if necessary</li>
* </ol>
...
...
@@ -1401,11 +1407,11 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
months subtracted.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
months subtracted.
* <p>
* This method subtracts the specified amount from the months field in three steps:
* <ol>
* <li>Subtract the input months
to
the month-of-year field</li>
* <li>Subtract the input months
from
the month-of-year field</li>
* <li>Check if the resulting date would be invalid</li>
* <li>Adjust the day-of-month to the last valid day if necessary</li>
* </ol>
...
...
@@ -1425,13 +1431,13 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
weeks subtracted.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
weeks subtracted.
* <p>
* This method subtracts the specified amount in weeks from the days field decrementing
* the month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
* For example, 2008-12-31 minus one week would result in
the
2009-01-07.
* For example, 2008-12-31 minus one week would result in 2009-01-07.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1444,13 +1450,13 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
days subtracted.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
days subtracted.
* <p>
* This method subtracts the specified amount from the days field
in
crementing the
* This method subtracts the specified amount from the days field
de
crementing the
* month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
* For example, 2008-12-31 minus one day would result in
the
2009-01-01.
* For example, 2008-12-31 minus one day would result in 2009-01-01.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1463,7 +1469,7 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
hours subtracted.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
hours subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1476,7 +1482,7 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
minutes subtracted.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
minutes subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1489,7 +1495,7 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
seconds subtracted.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
seconds subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1502,7 +1508,7 @@ public final class OffsetDateTime
}
/**
* Returns a copy of this {@code OffsetDateTime} with the specified
period in
nanoseconds subtracted.
* Returns a copy of this {@code OffsetDateTime} with the specified
number of
nanoseconds subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1599,7 +1605,7 @@ public final class OffsetDateTime
* objects in terms of a single {@code TemporalUnit}.
* The start and end points are {@code this} and the specified date-time.
* The result will be negative if the end is before the start.
* For example, the
period
in days between two date-times can be calculated
* For example, the
amount
in days between two date-times can be calculated
* using {@code startDateTime.until(endDateTime, DAYS)}.
* <p>
* The {@code Temporal} passed to this method is converted to a
...
...
@@ -1609,7 +1615,7 @@ public final class OffsetDateTime
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two date-times.
* For example, the
period
in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
* For example, the
amount
in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
* will only be one month as it is one minute short of two months.
* <p>
* There are two equivalent ways of using this method.
...
...
@@ -1770,7 +1776,7 @@ public final class OffsetDateTime
//-----------------------------------------------------------------------
/**
* Compares this
{@code OffsetDateTime}
to another date-time.
* Compares this
date-time
to another date-time.
* <p>
* The comparison is based on the instant then on the local date-time.
* It is "consistent with equals", as defined by {@link Comparable}.
...
...
src/share/classes/java/time/OffsetTime.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -153,14 +153,14 @@ public final class OffsetTime
/**
* Obtains the current time from the system clock in the default time-zone.
* <p>
* This will query the {@link
java.time.
Clock#systemDefaultZone() system clock} in the default
* This will query the {@link Clock#systemDefaultZone() system clock} in the default
* time-zone to obtain the current time.
* The offset will be calculated from the time-zone in the clock.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
* because the clock is hard-coded.
*
* @return the current time using the system clock, not null
* @return the current time using the system clock
and default time-zone
, not null
*/
public
static
OffsetTime
now
()
{
return
now
(
Clock
.
systemDefaultZone
());
...
...
@@ -169,7 +169,7 @@ public final class OffsetTime
/**
* Obtains the current time from the system clock in the specified time-zone.
* <p>
* This will query the {@link Clock#system(
java.time.
ZoneId) system clock} to obtain the current time.
* This will query the {@link Clock#system(ZoneId) system clock} to obtain the current time.
* Specifying the time-zone avoids dependence on the default time-zone.
* The offset will be calculated from the specified time-zone.
* <p>
...
...
@@ -277,7 +277,7 @@ public final class OffsetTime
* those fields that are equivalent to the relevant objects.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code OffsetTime::from}.
* allowing it to be used
as a query
via method reference, {@code OffsetTime::from}.
*
* @param temporal the temporal object to convert, not null
* @return the offset time, not null
...
...
@@ -402,7 +402,7 @@ public final class OffsetTime
/**
* Checks if the specified unit is supported.
* <p>
* This checks if the specified unit can be added to, or subtracted from, this
date
-time.
* This checks if the specified unit can be added to, or subtracted from, this
offset
-time.
* If false, then calling the {@link #plus(long, TemporalUnit)} and
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
* <p>
...
...
@@ -473,7 +473,7 @@ public final class OffsetTime
/**
* Gets the value of the specified field from this time as an {@code int}.
* <p>
* This queries this time for the value
for
the specified field.
* This queries this time for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -505,7 +505,7 @@ public final class OffsetTime
/**
* Gets the value of the specified field from this time as a {@code long}.
* <p>
* This queries this time for the value
for
the specified field.
* This queries this time for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
@@ -575,7 +575,7 @@ public final class OffsetTime
* <p>
* This method returns an object with the specified {@code ZoneOffset} and a {@code LocalTime}
* adjusted by the difference between the two offsets.
* This will result in the old and new objects representing the same instant
a
n an implied day.
* This will result in the old and new objects representing the same instant
o
n an implied day.
* This is useful for finding the local time in a different offset.
* For example, if this time represents {@code 10:30+02:00} and the offset specified is
* {@code +03:00}, then this method will return {@code 11:30+03:00}.
...
...
@@ -737,7 +737,7 @@ public final class OffsetTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code OffsetTime} with the hour-of-day
value
altered.
* Returns a copy of this {@code OffsetTime} with the hour-of-day altered.
* <p>
* The offset does not affect the calculation and will be the same in the result.
* <p>
...
...
@@ -752,7 +752,7 @@ public final class OffsetTime
}
/**
* Returns a copy of this {@code OffsetTime} with the minute-of-hour
value
altered.
* Returns a copy of this {@code OffsetTime} with the minute-of-hour altered.
* <p>
* The offset does not affect the calculation and will be the same in the result.
* <p>
...
...
@@ -767,7 +767,7 @@ public final class OffsetTime
}
/**
* Returns a copy of this {@code OffsetTime} with the second-of-minute
value
altered.
* Returns a copy of this {@code OffsetTime} with the second-of-minute altered.
* <p>
* The offset does not affect the calculation and will be the same in the result.
* <p>
...
...
@@ -782,7 +782,7 @@ public final class OffsetTime
}
/**
* Returns a copy of this {@code OffsetTime} with the nano-of-second
value
altered.
* Returns a copy of this {@code OffsetTime} with the nano-of-second altered.
* <p>
* The offset does not affect the calculation and will be the same in the result.
* <p>
...
...
@@ -884,7 +884,7 @@ public final class OffsetTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code OffsetTime} with the specified
period in
hours added.
* Returns a copy of this {@code OffsetTime} with the specified
number of
hours added.
* <p>
* This adds the specified number of hours to this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -899,7 +899,7 @@ public final class OffsetTime
}
/**
* Returns a copy of this {@code OffsetTime} with the specified
period in
minutes added.
* Returns a copy of this {@code OffsetTime} with the specified
number of
minutes added.
* <p>
* This adds the specified number of minutes to this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -914,7 +914,7 @@ public final class OffsetTime
}
/**
* Returns a copy of this {@code OffsetTime} with the specified
period in
seconds added.
* Returns a copy of this {@code OffsetTime} with the specified
number of
seconds added.
* <p>
* This adds the specified number of seconds to this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -929,7 +929,7 @@ public final class OffsetTime
}
/**
* Returns a copy of this {@code OffsetTime} with the specified
period in
nanoseconds added.
* Returns a copy of this {@code OffsetTime} with the specified
number of
nanoseconds added.
* <p>
* This adds the specified number of nanoseconds to this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -995,7 +995,7 @@ public final class OffsetTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code OffsetTime} with the specified
period in
hours subtracted.
* Returns a copy of this {@code OffsetTime} with the specified
number of
hours subtracted.
* <p>
* This subtracts the specified number of hours from this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1010,7 +1010,7 @@ public final class OffsetTime
}
/**
* Returns a copy of this {@code OffsetTime} with the specified
period in
minutes subtracted.
* Returns a copy of this {@code OffsetTime} with the specified
number of
minutes subtracted.
* <p>
* This subtracts the specified number of minutes from this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1025,7 +1025,7 @@ public final class OffsetTime
}
/**
* Returns a copy of this {@code OffsetTime} with the specified
period in
seconds subtracted.
* Returns a copy of this {@code OffsetTime} with the specified
number of
seconds subtracted.
* <p>
* This subtracts the specified number of seconds from this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1040,7 +1040,7 @@ public final class OffsetTime
}
/**
* Returns a copy of this {@code OffsetTime} with the specified
period in
nanoseconds subtracted.
* Returns a copy of this {@code OffsetTime} with the specified
number of
nanoseconds subtracted.
* <p>
* This subtracts the specified number of nanoseconds from this time, returning a new time.
* The calculation wraps around midnight.
...
...
@@ -1130,7 +1130,7 @@ public final class OffsetTime
* objects in terms of a single {@code TemporalUnit}.
* The start and end points are {@code this} and the specified time.
* The result will be negative if the end is before the start.
* For example, the
period
in hours between two times can be calculated
* For example, the
amount
in hours between two times can be calculated
* using {@code startTime.until(endTime, HOURS)}.
* <p>
* The {@code Temporal} passed to this method is converted to a
...
...
@@ -1140,7 +1140,7 @@ public final class OffsetTime
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two times.
* For example, the
period
in hours between 11:30Z and 13:29Z will only
* For example, the
amount
in hours between 11:30Z and 13:29Z will only
* be one hour as it is one minute short of two hours.
* <p>
* There are two equivalent ways of using this method.
...
...
@@ -1165,7 +1165,7 @@ public final class OffsetTime
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param endExclusive the end
dat
e, exclusive, which is converted to an {@code OffsetTime}, not null
* @param endExclusive the end
tim
e, exclusive, which is converted to an {@code OffsetTime}, not null
* @param unit the unit to measure the amount in, not null
* @return the amount of time between this time and the end time
* @throws DateTimeException if the amount cannot be calculated, or the end
...
...
src/share/classes/java/time/Period.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -616,7 +616,7 @@ public final class Period
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param amountToAdd the
period
to add, not null
* @param amountToAdd the
amount
to add, not null
* @return a {@code Period} based on this period with the requested period added, not null
* @throws DateTimeException if the specified amount has a non-ISO chronology or
* contains an invalid unit
...
...
@@ -705,7 +705,7 @@ public final class Period
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param amountToSubtract the
period
to subtract, not null
* @param amountToSubtract the
amount
to subtract, not null
* @return a {@code Period} based on this period with the requested period subtracted, not null
* @throws DateTimeException if the specified amount has a non-ISO chronology or
* contains an invalid unit
...
...
src/share/classes/java/time/Year.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -164,7 +164,7 @@ public final class Year
/**
* Obtains the current year from the system clock in the default time-zone.
* <p>
* This will query the {@link
java.time.
Clock#systemDefaultZone() system clock} in the default
* This will query the {@link Clock#systemDefaultZone() system clock} in the default
* time-zone to obtain the current year.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
...
...
@@ -179,7 +179,7 @@ public final class Year
/**
* Obtains the current year from the system clock in the specified time-zone.
* <p>
* This will query the {@link Clock#system(
java.time.
ZoneId) system clock} to obtain the current year.
* This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year.
* Specifying the time-zone avoids dependence on the default time-zone.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
...
...
@@ -240,7 +240,7 @@ public final class Year
* chronology, or can be converted to a {@code LocalDate}.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code Year::from}.
* allowing it to be used
as a query
via method reference, {@code Year::from}.
*
* @param temporal the temporal object to convert, not null
* @return the year, not null
...
...
@@ -375,7 +375,7 @@ public final class Year
/**
* Checks if the specified unit is supported.
* <p>
* This checks if the specified unit can be added to, or subtracted from, this
date-time
.
* This checks if the specified unit can be added to, or subtracted from, this
year
.
* If false, then calling the {@link #plus(long, TemporalUnit)} and
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
* <p>
...
...
@@ -441,7 +441,7 @@ public final class Year
/**
* Gets the value of the specified field from this year as an {@code int}.
* <p>
* This queries this year for the value
for
the specified field.
* This queries this year for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -472,7 +472,7 @@ public final class Year
/**
* Gets the value of the specified field from this year as a {@code long}.
* <p>
* This queries this year for the value
for
the specified field.
* This queries this year for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
@@ -720,13 +720,13 @@ public final class Year
}
/**
* Returns a copy of this
year
with the specified number of years added.
* Returns a copy of this
{@code Year}
with the specified number of years added.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param yearsToAdd the years to add, may be negative
* @return a {@code Year} based on this year with the
period
added, not null
* @throws DateTimeException if the result exceeds the supported
year
range
* @return a {@code Year} based on this year with the
years
added, not null
* @throws DateTimeException if the result exceeds the supported range
*/
public
Year
plusYears
(
long
yearsToAdd
)
{
if
(
yearsToAdd
==
0
)
{
...
...
@@ -786,13 +786,13 @@ public final class Year
}
/**
* Returns a copy of this
year
with the specified number of years subtracted.
* Returns a copy of this
{@code Year}
with the specified number of years subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param yearsToSubtract the years to subtract, may be negative
* @return a {@code Year} based on this year with the
period
subtracted, not null
* @throws DateTimeException if the result exceeds the supported
year
range
* @return a {@code Year} based on this year with the
year
subtracted, not null
* @throws DateTimeException if the result exceeds the supported range
*/
public
Year
minusYears
(
long
yearsToSubtract
)
{
return
(
yearsToSubtract
==
Long
.
MIN_VALUE
?
plusYears
(
Long
.
MAX_VALUE
).
plusYears
(
1
)
:
plusYears
(-
yearsToSubtract
));
...
...
@@ -871,12 +871,12 @@ public final class Year
* The result will be negative if the end is before the start.
* The {@code Temporal} passed to this method is converted to a
* {@code Year} using {@link #from(TemporalAccessor)}.
* For example, the
period
in decades between two year can be calculated
* For example, the
amount
in decades between two year can be calculated
* using {@code startYear.until(endYear, DECADES)}.
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two years.
* For example, the
period
in decades between 2012 and 2031
* For example, the
amount
in decades between 2012 and 2031
* will only be one decade as it is one year short of two decades.
* <p>
* There are two equivalent ways of using this method.
...
...
@@ -948,7 +948,7 @@ public final class Year
* <p>
* The day-of-year value 366 is only valid in a leap year.
*
* @param dayOfYear the day-of-year to use,
not null
* @param dayOfYear the day-of-year to use,
from 1 to 365-366
* @return the local date formed from this year and the specified date of year, not null
* @throws DateTimeException if the day of year is zero or less, 366 or greater or equal
* to 366 and this is not a leap year
...
...
@@ -1025,7 +1025,7 @@ public final class Year
}
/**
*
Is this year
after the specified year.
*
Checks if this year is
after the specified year.
*
* @param other the other year to compare to, not null
* @return true if this is after the specified year
...
...
@@ -1035,7 +1035,7 @@ public final class Year
}
/**
*
Is this year
before the specified year.
*
Checks if this year is
before the specified year.
*
* @param other the other year to compare to, not null
* @return true if this point is before the specified year
...
...
src/share/classes/java/time/YearMonth.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -157,9 +157,8 @@ public final class YearMonth
/**
* Obtains the current year-month from the system clock in the default time-zone.
* <p>
* This will query the {@link
java.time.
Clock#systemDefaultZone() system clock} in the default
* This will query the {@link Clock#systemDefaultZone() system clock} in the default
* time-zone to obtain the current year-month.
* The zone and offset will be set based on the time-zone in the clock.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
* because the clock is hard-coded.
...
...
@@ -173,7 +172,7 @@ public final class YearMonth
/**
* Obtains the current year-month from the system clock in the specified time-zone.
* <p>
* This will query the {@link Clock#system(
java.time.
ZoneId) system clock} to obtain the current year-month.
* This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year-month.
* Specifying the time-zone avoids dependence on the default time-zone.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
...
...
@@ -243,7 +242,7 @@ public final class YearMonth
* chronology, or can be converted to a {@code LocalDate}.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code YearMonth::from}.
* allowing it to be used
as a query
via method reference, {@code YearMonth::from}.
*
* @param temporal the temporal object to convert, not null
* @return the year-month, not null
...
...
@@ -363,7 +362,7 @@ public final class YearMonth
/**
* Checks if the specified unit is supported.
* <p>
* This checks if the specified unit can be added to, or subtracted from, this
date-time
.
* This checks if the specified unit can be added to, or subtracted from, this
year-month
.
* If false, then calling the {@link #plus(long, TemporalUnit)} and
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
* <p>
...
...
@@ -430,7 +429,7 @@ public final class YearMonth
/**
* Gets the value of the specified field from this year-month as an {@code int}.
* <p>
* This queries this year-month for the value
for
the specified field.
* This queries this year-month for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -462,7 +461,7 @@ public final class YearMonth
/**
* Gets the value of the specified field from this year-month as a {@code long}.
* <p>
* This queries this year-month for the value
for
the specified field.
* This queries this year-month for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
@@ -819,7 +818,7 @@ public final class YearMonth
}
/**
* Returns a copy of this
year-month with the specified period in
years added.
* Returns a copy of this
{@code YearMonth} with the specified number of
years added.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -836,7 +835,7 @@ public final class YearMonth
}
/**
* Returns a copy of this
year-month with the specified period in
months added.
* Returns a copy of this
{@code YearMonth} with the specified number of
months added.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -906,7 +905,7 @@ public final class YearMonth
}
/**
* Returns a copy of this
year-month with the specified period in
years subtracted.
* Returns a copy of this
{@code YearMonth} with the specified number of
years subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -919,7 +918,7 @@ public final class YearMonth
}
/**
* Returns a copy of this
year-month with the specified period in
months subtracted.
* Returns a copy of this
{@code YearMonth} with the specified number of
months subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
...
...
@@ -1004,12 +1003,12 @@ public final class YearMonth
* The result will be negative if the end is before the start.
* The {@code Temporal} passed to this method is converted to a
* {@code YearMonth} using {@link #from(TemporalAccessor)}.
* For example, the
period
in years between two year-months can be calculated
* For example, the
amount
in years between two year-months can be calculated
* using {@code startYearMonth.until(endYearMonth, YEARS)}.
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two year-months.
* For example, the
period
in decades between 2012-06 and 2032-05
* For example, the
amount
in decades between 2012-06 and 2032-05
* will only be one decade as it is one month short of two decades.
* <p>
* There are two equivalent ways of using this method.
...
...
@@ -1134,7 +1133,7 @@ public final class YearMonth
}
/**
*
Is this year-month
after the specified year-month.
*
Checks if this year-month is
after the specified year-month.
*
* @param other the other year-month to compare to, not null
* @return true if this is after the specified year-month
...
...
@@ -1144,7 +1143,7 @@ public final class YearMonth
}
/**
*
Is this year-month
before the specified year-month.
*
Checks if this year-month is
before the specified year-month.
*
* @param other the other year-month to compare to, not null
* @return true if this point is before the specified year-month
...
...
src/share/classes/java/time/ZoneId.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -453,7 +453,7 @@ public abstract class ZoneId implements Serializable {
* zones over offset-based zones using {@link TemporalQueries#zone()}.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code ZoneId::from}.
* allowing it to be used
as a query
via method reference, {@code ZoneId::from}.
*
* @param temporal the temporal object to convert, not null
* @return the zone ID, not null
...
...
src/share/classes/java/time/ZoneOffset.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -89,7 +89,7 @@ import java.util.concurrent.ConcurrentMap;
/**
* A time-zone offset from Greenwich/UTC, such as {@code +02:00}.
* <p>
* A time-zone offset is the
period
of time that a time-zone differs from Greenwich/UTC.
* A time-zone offset is the
amount
of time that a time-zone differs from Greenwich/UTC.
* This is usually a fixed number of hours and minutes.
* <p>
* Different parts of the world have different time-zone offsets.
...
...
@@ -334,7 +334,7 @@ public final class ZoneOffset
* on extracting the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} field.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code ZoneOffset::from}.
* allowing it to be used
as a query
via method reference, {@code ZoneOffset::from}.
*
* @param temporal the temporal object to convert, not null
* @return the zone-offset, not null
...
...
@@ -564,7 +564,7 @@ public final class ZoneOffset
/**
* Gets the value of the specified field from this offset as an {@code int}.
* <p>
* This queries this offset for the value
for
the specified field.
* This queries this offset for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -599,7 +599,7 @@ public final class ZoneOffset
/**
* Gets the value of the specified field from this offset as a {@code long}.
* <p>
* This queries this offset for the value
for
the specified field.
* This queries this offset for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
src/share/classes/java/time/ZonedDateTime.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -419,7 +419,7 @@ public final class ZonedDateTime
* <p>
* Converting an instant to a zoned date-time is simple as there is only one valid
* offset for each instant. If the valid offset is different to the offset specified,
* the the date-time and offset of the zoned date-time will differ from those specified.
* the
n
the date-time and offset of the zoned date-time will differ from those specified.
* <p>
* If the {@code ZoneId} to be used is a {@code ZoneOffset}, this method is equivalent
* to {@link #of(LocalDateTime, ZoneId)}.
...
...
@@ -539,7 +539,7 @@ public final class ZonedDateTime
* those fields that are equivalent to the relevant objects.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code ZonedDateTime::from}.
* allowing it to be used
as a query
via method reference, {@code ZonedDateTime::from}.
*
* @param temporal the temporal object to convert, not null
* @return the zoned date-time, not null
...
...
@@ -783,7 +783,7 @@ public final class ZonedDateTime
/**
* Gets the value of the specified field from this date-time as an {@code int}.
* <p>
* This queries this date-time for the value
for
the specified field.
* This queries this date-time for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -825,7 +825,7 @@ public final class ZonedDateTime
/**
* Gets the value of the specified field from this date-time as a {@code long}.
* <p>
* This queries this date-time for the value
for
the specified field.
* This queries this date-time for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
@@ -1183,7 +1183,8 @@ public final class ZonedDateTime
* <p>
* A simple adjuster might simply set the one of the fields, such as the year field.
* A more complex adjuster might set the date to the last day of the month.
* A selection of common adjustments is provided in {@link TemporalAdjuster}.
* A selection of common adjustments is provided in
* {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
* These include finding the "last day of the month" and "next Wednesday".
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
...
...
@@ -1193,7 +1194,7 @@ public final class ZonedDateTime
* For example this code returns a date on the last day of July:
* <pre>
* import static java.time.Month.*;
* import static java.time.temporal.Adjusters.*;
* import static java.time.temporal.
Temporal
Adjusters.*;
*
* result = zonedDateTime.with(JULY).with(lastDayOfMonth());
* </pre>
...
...
@@ -1314,7 +1315,7 @@ public final class ZonedDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code ZonedDateTime} with the year
value
altered.
* Returns a copy of this {@code ZonedDateTime} with the year altered.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#withYear(int) changing the year} of the local date-time.
...
...
@@ -1336,7 +1337,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the month-of-year
value
altered.
* Returns a copy of this {@code ZonedDateTime} with the month-of-year altered.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#withMonth(int) changing the month} of the local date-time.
...
...
@@ -1358,7 +1359,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the day-of-month
value
altered.
* Returns a copy of this {@code ZonedDateTime} with the day-of-month altered.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#withDayOfMonth(int) changing the day-of-month} of the local date-time.
...
...
@@ -1405,7 +1406,7 @@ public final class ZonedDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code ZonedDateTime} with the hour-of-day
value
altered.
* Returns a copy of this {@code ZonedDateTime} with the hour-of-day altered.
* <p>
* This operates on the local time-line,
* {@linkplain LocalDateTime#withHour(int) changing the time} of the local date-time.
...
...
@@ -1427,7 +1428,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the minute-of-hour
value
altered.
* Returns a copy of this {@code ZonedDateTime} with the minute-of-hour altered.
* <p>
* This operates on the local time-line,
* {@linkplain LocalDateTime#withMinute(int) changing the time} of the local date-time.
...
...
@@ -1449,7 +1450,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the second-of-minute
value
altered.
* Returns a copy of this {@code ZonedDateTime} with the second-of-minute altered.
* <p>
* This operates on the local time-line,
* {@linkplain LocalDateTime#withSecond(int) changing the time} of the local date-time.
...
...
@@ -1471,7 +1472,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the nano-of-second
value
altered.
* Returns a copy of this {@code ZonedDateTime} with the nano-of-second altered.
* <p>
* This operates on the local time-line,
* {@linkplain LocalDateTime#withNano(int) changing the time} of the local date-time.
...
...
@@ -1507,7 +1508,7 @@ public final class ZonedDateTime
* {@link ChronoUnit#DAYS DAYS}. Other units throw an exception.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#truncatedTo(
java.time.temporal.
TemporalUnit) truncating}
* {@link LocalDateTime#truncatedTo(TemporalUnit) truncating}
* the underlying local date-time. This is then converted back to a
* {@code ZonedDateTime}, using the zone ID to obtain the offset.
* <p>
...
...
@@ -1608,7 +1609,7 @@ public final class ZonedDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
years added.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
years added.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#plusYears(long) adding years} to the local date-time.
...
...
@@ -1630,7 +1631,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
months added.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
months added.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#plusMonths(long) adding months} to the local date-time.
...
...
@@ -1652,7 +1653,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
weeks added.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
weeks added.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#plusWeeks(long) adding weeks} to the local date-time.
...
...
@@ -1674,7 +1675,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
days added.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
days added.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#plusDays(long) adding days} to the local date-time.
...
...
@@ -1697,7 +1698,7 @@ public final class ZonedDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
hours added.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
hours added.
* <p>
* This operates on the instant time-line, such that adding one hour will
* always be a duration of one hour later.
...
...
@@ -1725,7 +1726,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
minutes added.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
minutes added.
* <p>
* This operates on the instant time-line, such that adding one minute will
* always be a duration of one minute later.
...
...
@@ -1743,7 +1744,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
seconds added.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
seconds added.
* <p>
* This operates on the instant time-line, such that adding one second will
* always be a duration of one second later.
...
...
@@ -1761,7 +1762,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
nanoseconds added.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
nanoseconds added.
* <p>
* This operates on the instant time-line, such that adding one nano will
* always be a duration of one nano later.
...
...
@@ -1849,7 +1850,7 @@ public final class ZonedDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
years subtracted.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
years subtracted.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#minusYears(long) subtracting years} to the local date-time.
...
...
@@ -1871,7 +1872,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
months subtracted.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
months subtracted.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#minusMonths(long) subtracting months} to the local date-time.
...
...
@@ -1893,7 +1894,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
weeks subtracted.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
weeks subtracted.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#minusWeeks(long) subtracting weeks} to the local date-time.
...
...
@@ -1915,7 +1916,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
days subtracted.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
days subtracted.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#minusDays(long) subtracting days} to the local date-time.
...
...
@@ -1938,7 +1939,7 @@ public final class ZonedDateTime
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
hours subtracted.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
hours subtracted.
* <p>
* This operates on the instant time-line, such that subtracting one hour will
* always be a duration of one hour earlier.
...
...
@@ -1966,7 +1967,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
minutes subtracted.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
minutes subtracted.
* <p>
* This operates on the instant time-line, such that subtracting one minute will
* always be a duration of one minute earlier.
...
...
@@ -1984,7 +1985,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
seconds subtracted.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
seconds subtracted.
* <p>
* This operates on the instant time-line, such that subtracting one second will
* always be a duration of one second earlier.
...
...
@@ -2002,7 +2003,7 @@ public final class ZonedDateTime
}
/**
* Returns a copy of this {@code ZonedDateTime} with the specified
period in
nanoseconds subtracted.
* Returns a copy of this {@code ZonedDateTime} with the specified
number of
nanoseconds subtracted.
* <p>
* This operates on the instant time-line, such that subtracting one nano will
* always be a duration of one nano earlier.
...
...
@@ -2029,7 +2030,7 @@ public final class ZonedDateTime
* what the result of this method will be.
* <p>
* The result of this method is obtained by invoking the
* {@link
java.time.temporal.
TemporalQuery#queryFrom(TemporalAccessor)} method on the
* {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
* specified query passing {@code this} as the argument.
*
* @param <R> the type of the result
...
...
@@ -2054,7 +2055,7 @@ public final class ZonedDateTime
* objects in terms of a single {@code TemporalUnit}.
* The start and end points are {@code this} and the specified date-time.
* The result will be negative if the end is before the start.
* For example, the
period
in days between two date-times can be calculated
* For example, the
amount
in days between two date-times can be calculated
* using {@code startDateTime.until(endDateTime, DAYS)}.
* <p>
* The {@code Temporal} passed to this method is converted to a
...
...
@@ -2064,7 +2065,7 @@ public final class ZonedDateTime
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two date-times.
* For example, the
period
in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
* For example, the
amount
in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
* will only be one month as it is one minute short of two months.
* <p>
* There are two equivalent ways of using this method.
...
...
src/share/classes/java/time/chrono/ChronoLocalDate.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -249,8 +249,8 @@ public interface ChronoLocalDate
* This allows dates in different calendar systems to be compared based
* on the position of the date on the local time-line.
* The underlying comparison is equivalent to comparing the epoch-day.
* @return a comparator that compares in time-line order ignoring the chronology
*
* @return a comparator that compares in time-line order ignoring the chronology
* @see #isAfter
* @see #isBefore
* @see #isEqual
...
...
src/share/classes/java/time/chrono/ChronoLocalDateImpl.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -227,7 +227,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
//-----------------------------------------------------------------------
/**
* Returns a copy of this date with the specified
period in
years added.
* Returns a copy of this date with the specified
number of
years added.
* <p>
* This adds the specified period in years to the date.
* In some cases, adding years can cause the resulting date to become invalid.
...
...
@@ -243,7 +243,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
abstract
D
plusYears
(
long
yearsToAdd
);
/**
* Returns a copy of this date with the specified
period in
months added.
* Returns a copy of this date with the specified
number of
months added.
* <p>
* This adds the specified period in months to the date.
* In some cases, adding months can cause the resulting date to become invalid.
...
...
@@ -259,7 +259,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
abstract
D
plusMonths
(
long
monthsToAdd
);
/**
* Returns a copy of this date with the specified
period in
weeks added.
* Returns a copy of this date with the specified
number of
weeks added.
* <p>
* This adds the specified period in weeks to the date.
* In some cases, adding weeks can cause the resulting date to become invalid.
...
...
@@ -292,7 +292,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
//-----------------------------------------------------------------------
/**
* Returns a copy of this date with the specified
period in
years subtracted.
* Returns a copy of this date with the specified
number of
years subtracted.
* <p>
* This subtracts the specified period in years to the date.
* In some cases, subtracting years can cause the resulting date to become invalid.
...
...
@@ -313,7 +313,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
}
/**
* Returns a copy of this date with the specified
period in
months subtracted.
* Returns a copy of this date with the specified
number of
months subtracted.
* <p>
* This subtracts the specified period in months to the date.
* In some cases, subtracting months can cause the resulting date to become invalid.
...
...
@@ -334,7 +334,7 @@ abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
}
/**
* Returns a copy of this date with the specified
period in
weeks subtracted.
* Returns a copy of this date with the specified
number of
weeks subtracted.
* <p>
* This subtracts the specified period in weeks to the date.
* In some cases, subtracting weeks can cause the resulting date to become invalid.
...
...
src/share/classes/java/time/chrono/ChronoLocalDateTime.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -131,7 +131,6 @@ public interface ChronoLocalDateTime<D extends ChronoLocalDate>
* The underlying comparison is equivalent to comparing the epoch-day and nano-of-day.
*
* @return a comparator that compares in time-line order ignoring the chronology
*
* @see #isAfter
* @see #isBefore
* @see #isEqual
...
...
@@ -323,7 +322,7 @@ public interface ChronoLocalDateTime<D extends ChronoLocalDate>
* what the result of this method will be.
* <p>
* The result of this method is obtained by invoking the
* {@link
java.time.temporal.
TemporalQuery#queryFrom(TemporalAccessor)} method on the
* {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
* specified query passing {@code this} as the argument.
*
* @param <R> the type of the result
...
...
src/share/classes/java/time/chrono/ChronoZonedDateTime.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -132,7 +132,6 @@ public interface ChronoZonedDateTime<D extends ChronoLocalDate>
* The underlying comparison is equivalent to comparing the epoch-second and nano-of-second.
*
* @return a comparator that compares in time-line order ignoring the chronology
*
* @see #isAfter
* @see #isBefore
* @see #isEqual
...
...
@@ -292,7 +291,7 @@ public interface ChronoZonedDateTime<D extends ChronoLocalDate>
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return a {@code
ZoneChrono
DateTime} based on this date-time with the earlier offset, not null
* @return a {@code
ChronoZoned
DateTime} based on this date-time with the earlier offset, not null
* @throws DateTimeException if no rules can be found for the zone
* @throws DateTimeException if no rules are valid for this date-time
*/
...
...
@@ -319,7 +318,7 @@ public interface ChronoZonedDateTime<D extends ChronoLocalDate>
ChronoZonedDateTime
<
D
>
withLaterOffsetAtOverlap
();
/**
* Returns a copy of this
ZonedDateT
ime with a different time-zone,
* Returns a copy of this
date-t
ime with a different time-zone,
* retaining the local date-time if possible.
* <p>
* This method changes the time-zone and retains the local date-time.
...
...
@@ -470,7 +469,7 @@ public interface ChronoZonedDateTime<D extends ChronoLocalDate>
* what the result of this method will be.
* <p>
* The result of this method is obtained by invoking the
* {@link
java.time.temporal.
TemporalQuery#queryFrom(TemporalAccessor)} method on the
* {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
* specified query passing {@code this} as the argument.
*
* @param <R> the type of the result
...
...
src/share/classes/java/time/chrono/Chronology.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -132,8 +132,9 @@ import java.util.Set;
* The set of available chronologies can be extended by applications.
* Adding a new calendar system requires the writing of an implementation of
* {@code Chronology}, {@code ChronoLocalDate} and {@code Era}.
* The majority of the logic specific to the calendar system will be in
* {@code ChronoLocalDate}. The {@code Chronology} subclass acts as a factory.
* The majority of the logic specific to the calendar system will be in the
* {@code ChronoLocalDate} implementation.
* The {@code Chronology} implementation acts as a factory.
* <p>
* To permit the discovery of additional chronologies, the {@link java.util.ServiceLoader ServiceLoader}
* is used. A file must be added to the {@code META-INF/services} directory with the
...
...
@@ -167,7 +168,7 @@ public interface Chronology extends Comparable<Chronology> {
* If the specified temporal object does not have a chronology, {@link IsoChronology} is returned.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used
in queries
via method reference, {@code Chronology::from}.
* allowing it to be used
as a query
via method reference, {@code Chronology::from}.
*
* @param temporal the temporal to convert, not null
* @return the chronology, not null
...
...
@@ -413,7 +414,7 @@ public interface Chronology extends Comparable<Chronology> {
* The alternate clock may be introduced using {@link Clock dependency injection}.
*
* @implSpec
* The default implementation invokes {@link #date(TemporalAccessor)}
)}
.
* The default implementation invokes {@link #date(TemporalAccessor)}.
*
* @param clock the clock to use, not null
* @return the current local date, not null
...
...
@@ -622,7 +623,7 @@ public interface Chronology extends Comparable<Chronology> {
* The parameters control the style of the returned text and the locale.
*
* @implSpec
* The default implementation behaves as th
e
the formatter was used to
* The default implementation behaves as th
ough
the formatter was used to
* format the chronology textual name.
*
* @param style the style of the text required, not null
...
...
src/share/classes/java/time/chrono/Era.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -182,7 +182,7 @@ public interface Era extends TemporalAccessor, TemporalAdjuster {
/**
* Gets the value of the specified field from this era as an {@code int}.
* <p>
* This queries this era for the value
for
the specified field.
* This queries this era for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
...
...
@@ -215,7 +215,7 @@ public interface Era extends TemporalAccessor, TemporalAdjuster {
/**
* Gets the value of the specified field from this era as a {@code long}.
* <p>
* This queries this era for the value
for
the specified field.
* This queries this era for the value
of
the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
...
...
src/share/classes/java/time/chrono/HijrahChronology.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -394,7 +394,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
* Gets the ID of the chronology.
* <p>
* The ID uniquely identifies the {@code Chronology}. It can be used to
* lookup the {@code Chronology} using {@link #of(String)}.
* lookup the {@code Chronology} using {@link
Chronology
#of(String)}.
*
* @return the chronology ID, non-null
* @see #getCalendarType()
...
...
@@ -409,7 +409,7 @@ public final class HijrahChronology extends AbstractChronology implements Serial
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
* It can be used to lookup the {@code Chronology} using {@link
Chronology
#of(String)}.
*
* @return the calendar system type; non-null if the calendar has
* a standard type, otherwise null
...
...
src/share/classes/java/time/chrono/IsoChronology.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -143,7 +143,7 @@ public final class IsoChronology extends AbstractChronology implements Serializa
* Gets the ID of the chronology - 'ISO'.
* <p>
* The ID uniquely identifies the {@code Chronology}.
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
* It can be used to lookup the {@code Chronology} using {@link
Chronology
#of(String)}.
*
* @return the chronology ID - 'ISO'
* @see #getCalendarType()
...
...
@@ -158,7 +158,7 @@ public final class IsoChronology extends AbstractChronology implements Serializa
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
* It can be used to lookup the {@code Chronology} using {@link
Chronology
#of(String)}.
* It can also be used as part of a locale, accessible via
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
*
...
...
src/share/classes/java/time/chrono/JapaneseChronology.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -150,7 +150,7 @@ public final class JapaneseChronology extends AbstractChronology implements Seri
* Gets the ID of the chronology - 'Japanese'.
* <p>
* The ID uniquely identifies the {@code Chronology}.
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
* It can be used to lookup the {@code Chronology} using {@link
Chronology
#of(String)}.
*
* @return the chronology ID - 'Japanese'
* @see #getCalendarType()
...
...
@@ -165,7 +165,7 @@ public final class JapaneseChronology extends AbstractChronology implements Seri
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
* It can be used to lookup the {@code Chronology} using {@link
Chronology
#of(String)}.
* It can also be used as part of a locale, accessible via
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
*
...
...
src/share/classes/java/time/chrono/MinguoChronology.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -132,7 +132,7 @@ public final class MinguoChronology extends AbstractChronology implements Serial
* Gets the ID of the chronology - 'Minguo'.
* <p>
* The ID uniquely identifies the {@code Chronology}.
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
* It can be used to lookup the {@code Chronology} using {@link
Chronology
#of(String)}.
*
* @return the chronology ID - 'Minguo'
* @see #getCalendarType()
...
...
@@ -147,7 +147,7 @@ public final class MinguoChronology extends AbstractChronology implements Serial
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
* It can be used to lookup the {@code Chronology} using {@link
Chronology
#of(String)}.
* It can also be used as part of a locale, accessible via
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
*
...
...
src/share/classes/java/time/chrono/ThaiBuddhistChronology.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -168,7 +168,7 @@ public final class ThaiBuddhistChronology extends AbstractChronology implements
* Gets the ID of the chronology - 'ThaiBuddhist'.
* <p>
* The ID uniquely identifies the {@code Chronology}.
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
* It can be used to lookup the {@code Chronology} using {@link
Chronology
#of(String)}.
*
* @return the chronology ID - 'ThaiBuddhist'
* @see #getCalendarType()
...
...
@@ -183,7 +183,7 @@ public final class ThaiBuddhistChronology extends AbstractChronology implements
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
* It can be used to lookup the {@code Chronology} using {@link #of(String)}.
* It can be used to lookup the {@code Chronology} using {@link
Chronology
#of(String)}.
* It can also be used as part of a locale, accessible via
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
*
...
...
src/share/classes/java/time/format/DateTimeFormatter.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -117,7 +117,7 @@ import java.util.Set;
* {@code parse(CharSequence text, DateTimeFormatter formatter)}.
* <p>For example:
* <blockquote><pre>
* String text = date.
toString
(formatter);
* String text = date.
format
(formatter);
* LocalDate date = LocalDate.parse(text, formatter);
* </pre></blockquote>
* <p>
...
...
@@ -266,7 +266,7 @@ import java.util.Set;
* For example:
* <blockquote><pre>
* DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd");
* String text = date.
toString
(formatter);
* String text = date.
format
(formatter);
* LocalDate date = LocalDate.parse(text, formatter);
* </pre></blockquote>
* <p>
...
...
@@ -1976,7 +1976,7 @@ public final class DateTimeFormatter {
* Errors are returned using the error index field of the {@code ParsePosition}
* instead of {@code DateTimeParseException}.
* The returned error index will be set to an index indicative of the error.
* Callers must check for errors before using the
contex
t.
* Callers must check for errors before using the
resul
t.
* <p>
* If the formatter parses the same field more than once with different values,
* the result will be an error.
...
...
src/share/classes/java/time/format/DateTimeFormatterBuilder.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -31,7 +31,7 @@
*
* Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
*
* All rights reserved.
* All rights
hg q
reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -137,7 +137,6 @@ import sun.util.locale.provider.TimeZoneNameUtility;
* <li>ChronologyText - the name of the chronology</li>
* <li>Literal - a text literal</li>
* <li>Nested and Optional - formats can be nested or made optional</li>
* <li>Other - the printer and parser interfaces can be used to add user supplied formatting</li>
* </ul>
* In addition, any of the elements may be decorated by padding, either with spaces or any other character.
* <p>
...
...
@@ -194,8 +193,8 @@ public final class DateTimeFormatterBuilder {
* The locale and chronology are used to lookup the locale specific format
* for the requested dateStyle and/or timeStyle.
*
* @param dateStyle the FormatStyle for the date
* @param timeStyle the FormatStyle for the time
* @param dateStyle the FormatStyle for the date
, null for time-only pattern
* @param timeStyle the FormatStyle for the time
, null for date-only pattern
* @param chrono the Chronology, non-null
* @param locale the locale, non-null
* @return the locale and Chronology specific formatting pattern
...
...
@@ -747,9 +746,9 @@ public final class DateTimeFormatterBuilder {
* defines the connection between each value and the text:
* <pre>
* Map<Long, String> map = new HashMap<>();
* map.put(1, "JNY");
* map.put(2, "FBY");
* map.put(3, "MCH");
* map.put(1
L
, "JNY");
* map.put(2
L
, "FBY");
* map.put(3
L
, "MCH");
* ...
* builder.appendText(MONTH_OF_YEAR, map);
* </pre>
...
...
@@ -841,7 +840,7 @@ public final class DateTimeFormatterBuilder {
* <p>
* The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
* The end-of-day time of '24:00' is handled as midnight at the start of the following day.
* The leap-second time of '23:59:
59
' is handled to some degree, see
* The leap-second time of '23:59:
60
' is handled to some degree, see
* {@link DateTimeFormatter#parsedLeapSecond()} for full details.
* <p>
* An alternative to this method is to format/parse the instant as a single
...
...
@@ -864,7 +863,7 @@ public final class DateTimeFormatterBuilder {
* Appends the zone offset, such as '+01:00', to the formatter.
* <p>
* This appends an instruction to format/parse the offset ID to the builder.
* This is equivalent to calling {@code appendOffset("HH:MM:ss", "Z")}.
* This is equivalent to calling {@code appendOffset("
+
HH:MM:ss", "Z")}.
*
* @return this, for chaining, not null
*/
...
...
@@ -1049,7 +1048,7 @@ public final class DateTimeFormatterBuilder {
* "GMT+01:30" -- ZoneOffset.of("+01:30")
* </pre>
* <p>
* Note that this method is i
s i
dentical to {@code appendZoneId()} except
* Note that this method is identical to {@code appendZoneId()} except
* in the mechanism used to obtain the zone.
* Note also that parsing accepts offsets, whereas formatting will never
* produce one.
...
...
@@ -1107,7 +1106,7 @@ public final class DateTimeFormatterBuilder {
* "GMT+01:30" -- ZoneOffset.of("GMT+01:30")
* </pre>
* <p>
* Note that this method is i
s i
dentical to {@code appendZoneId()} except
* Note that this method is identical to {@code appendZoneId()} except
* in the mechanism used to obtain the zone.
*
* @return this, for chaining, not null
...
...
@@ -1132,7 +1131,7 @@ public final class DateTimeFormatterBuilder {
* for the locale set in the {@link DateTimeFormatter}.
* If the temporal object being printed represents an instant, then the text
* will be the summer or winter time text as appropriate.
* If the lookup for text does not find any suitable re
us
lt, then the
* If the lookup for text does not find any suitable re
su
lt, then the
* {@link ZoneId#getId() ID} will be printed instead.
* If the zone cannot be obtained then an exception is thrown unless the
* section of the formatter is optional.
...
...
@@ -1168,7 +1167,7 @@ public final class DateTimeFormatterBuilder {
* for the locale set in the {@link DateTimeFormatter}.
* If the temporal object being printed represents an instant, then the text
* will be the summer or winter time text as appropriate.
* If the lookup for text does not find any suitable re
us
lt, then the
* If the lookup for text does not find any suitable re
su
lt, then the
* {@link ZoneId#getId() ID} will be printed instead.
* If the zone cannot be obtained then an exception is thrown unless the
* section of the formatter is optional.
...
...
@@ -1182,7 +1181,7 @@ public final class DateTimeFormatterBuilder {
* zone. This method also allows a set of preferred {@link ZoneId} to be
* specified for parsing. The matched preferred zone id will be used if the
* textural zone name being parsed is not unique.
*
*
<p>
* If the zone cannot be parsed then an exception is thrown unless the
* section of the formatter is optional.
*
...
...
@@ -1227,7 +1226,6 @@ public final class DateTimeFormatterBuilder {
* <p>
* The calendar system name will be output during a format.
* If the chronology cannot be obtained then an exception will be thrown.
* The calendar system name is obtained from the Chronology.
*
* @param textStyle the text style to use, not null
* @return this, for chaining, not null
...
...
@@ -1453,7 +1451,7 @@ public final class DateTimeFormatterBuilder {
* LLLLL 5 appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW_STANDALONE)
*
* w 1 append special localized WeekFields element for numeric week-of-year
* ww
1
append special localized WeekFields element for numeric week-of-year, zero-padded
* ww
2
append special localized WeekFields element for numeric week-of-year, zero-padded
* W 1 append special localized WeekFields element for numeric week-of-month
* d 1 appendValue(ChronoField.DAY_OF_MONTH)
* dd 2 appendValue(ChronoField.DAY_OF_MONTH, 2)
...
...
@@ -1880,7 +1878,6 @@ public final class DateTimeFormatterBuilder {
* <p>
* During parsing, the padding and decorated element are parsed.
* If parsing is lenient, then the pad width is treated as a maximum.
* If parsing is case insensitive, then the pad character is matched ignoring case.
* The padding is parsed greedily. Thus, if the decorated element starts with
* the pad character, it will not be parsed.
*
...
...
src/share/classes/java/time/format/DecimalStyle.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -62,7 +62,6 @@
package
java.time.format
;
import
java.text.DecimalFormatSymbols
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.Locale
;
...
...
@@ -138,7 +137,7 @@ public final class DecimalStyle {
* of(Locale.getDefault(Locale.Category.FORMAT))}.
*
* @see java.util.Locale.Category#FORMAT
* @return the
info
, not null
* @return the
decimal style
, not null
*/
public
static
DecimalStyle
ofDefaultLocale
()
{
return
of
(
Locale
.
getDefault
(
Locale
.
Category
.
FORMAT
));
...
...
@@ -150,7 +149,7 @@ public final class DecimalStyle {
* This method provides access to locale sensitive decimal style symbols.
*
* @param locale the locale, not null
* @return the
info
, not null
* @return the
decimal style
, not null
*/
public
static
DecimalStyle
of
(
Locale
locale
)
{
Objects
.
requireNonNull
(
locale
,
"locale"
);
...
...
@@ -340,7 +339,7 @@ public final class DecimalStyle {
//-----------------------------------------------------------------------
/**
* Checks if this DecimalStyle is equal another DecimalStyle.
* Checks if this DecimalStyle is equal
to
another DecimalStyle.
*
* @param obj the object to check, null returns false
* @return true if this is equal to the other date
...
...
src/share/classes/java/time/temporal/IsoFields.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -638,7 +638,7 @@ public final class IsoFields {
//-----------------------------------------------------------------------
/**
* Implementation of the
period
unit.
* Implementation of the unit.
*/
private
static
enum
Unit
implements
TemporalUnit
{
...
...
src/share/classes/java/time/temporal/Temporal.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -157,7 +157,8 @@ public interface Temporal extends TemporalAccessor {
* This adjusts this date-time according to the rules of the specified adjuster.
* A simple adjuster might simply set the one of the fields, such as the year field.
* A more complex adjuster might set the date to the last day of the month.
* A selection of common adjustments is provided in {@link TemporalAdjuster}.
* A selection of common adjustments is provided in
* {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
* These include finding the "last day of the month" and "next Wednesday".
* The adjuster is responsible for handling special cases, such as the varying
* lengths of month and leap years.
...
...
@@ -287,7 +288,7 @@ public interface Temporal extends TemporalAccessor {
* This provides equivalent, safe behavior for immutable and mutable implementations.
*
* @param amountToAdd the amount of the specified unit to add, may be negative
* @param unit the unit of the
period
to add, not null
* @param unit the unit of the
amount
to add, not null
* @return an object of the same type with the specified period added, not null
* @throws DateTimeException if the unit cannot be added
* @throws UnsupportedTemporalTypeException if the unit is not supported
...
...
@@ -359,7 +360,7 @@ public interface Temporal extends TemporalAccessor {
* </pre>
*
* @param amountToSubtract the amount of the specified unit to subtract, may be negative
* @param unit the unit of the
period
to subtract, not null
* @param unit the unit of the
amount
to subtract, not null
* @return an object of the same type with the specified period subtracted, not null
* @throws DateTimeException if the unit cannot be subtracted
* @throws UnsupportedTemporalTypeException if the unit is not supported
...
...
@@ -378,12 +379,12 @@ public interface Temporal extends TemporalAccessor {
* The start and end points are {@code this} and the specified temporal.
* The end point is converted to be of the same type as the start point if different.
* The result will be negative if the end is before the start.
* For example, the
period
in hours between two temporal objects can be
* For example, the
amount
in hours between two temporal objects can be
* calculated using {@code startTime.until(endTime, HOURS)}.
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two temporals.
* For example, the
period
in hours between the times 11:30 and 13:29
* For example, the
amount
in hours between the times 11:30 and 13:29
* will only be one hour as it is one minute short of two hours.
* <p>
* There are two equivalent ways of using this method.
...
...
src/share/classes/java/time/temporal/TemporalAccessor.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -180,7 +180,7 @@ public interface TemporalAccessor {
/**
* Gets the value of the specified field as an {@code int}.
* <p>
* This queries the date-time for the value
for
the specified field.
* This queries the date-time for the value
of
the specified field.
* The returned value will always be within the valid range of values for the field.
* If the date-time cannot return the value, because the field is unsupported or for
* some other reason, an exception will be thrown.
...
...
@@ -229,7 +229,7 @@ public interface TemporalAccessor {
/**
* Gets the value of the specified field as a {@code long}.
* <p>
* This queries the date-time for the value
for
the specified field.
* This queries the date-time for the value
of
the specified field.
* The returned value may be outside the valid range of values for the field.
* If the date-time cannot return the value, because the field is unsupported or for
* some other reason, an exception will be thrown.
...
...
src/share/classes/java/time/temporal/TemporalField.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -116,7 +116,7 @@ public interface TemporalField {
* For example, in the field 'MonthOfYear', the unit is 'Months'.
* See also {@link #getRangeUnit()}.
*
* @return the
period
unit defining the base unit of the field, not null
* @return the unit defining the base unit of the field, not null
*/
TemporalUnit
getBaseUnit
();
...
...
@@ -130,7 +130,7 @@ public interface TemporalField {
* The range is never null. For example, the 'Year' field is shorthand for
* 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'.
*
* @return the
period
unit defining the range of the field, not null
* @return the unit defining the range of the field, not null
*/
TemporalUnit
getRangeUnit
();
...
...
@@ -179,7 +179,7 @@ public interface TemporalField {
* Checks if this field is supported by the temporal object.
* <p>
* This determines whether the temporal accessor supports this field.
* If this returns false, the the temporal cannot be queried for this field.
* If this returns false, the
n
the temporal cannot be queried for this field.
* <p>
* There are two equivalent ways of using this method.
* The first is to invoke this method directly.
...
...
src/share/classes/java/time/temporal/TemporalUnit.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -221,7 +221,7 @@ public interface TemporalUnit {
* @param temporal the temporal object to adjust, not null
* @param amount the amount of this unit to add, positive or negative
* @return the adjusted temporal object, not null
* @throws DateTimeException if the
period
cannot be added
* @throws DateTimeException if the
amount
cannot be added
* @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal
*/
<
R
extends
Temporal
>
R
addTo
(
R
temporal
,
long
amount
);
...
...
src/share/classes/java/time/zone/ZoneOffsetTransition.java
浏览文件 @
58c733a5
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -83,7 +83,7 @@ import java.util.Objects;
* The discontinuity is normally a gap in spring and an overlap in autumn.
* {@code ZoneOffsetTransition} models the transition between the two offsets.
* <p>
* Gaps occur where there are local date-times that simply do not
not
exist.
* Gaps occur where there are local date-times that simply do not exist.
* An example would be when the offset changes from {@code +03:00} to {@code +04:00}.
* This might be described as 'the clocks will move forward one hour tonight at 1am'.
* <p>
...
...
@@ -334,7 +334,7 @@ public final class ZoneOffsetTransition
/**
* Does this transition represent a gap in the local time-line.
* <p>
* Gaps occur where there are local date-times that simply do not
not
exist.
* Gaps occur where there are local date-times that simply do not exist.
* An example would be when the offset changes from {@code +01:00} to {@code +02:00}.
* This might be described as 'the clocks will move forward one hour tonight at 1am'.
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录