src/share/classes/java/time/temporal/TemporalAmount.java

Print this page

        

@@ -73,11 +73,11 @@
  * This is the base interface type for amounts of time.
  * An amount is distinct from a date or time-of-day in that it is not tied
  * to any specific point on the time-line.
  * <p>
  * The amount can be thought of as a {@code Map} of {@link TemporalUnit} to
- * {@code long}, exposed via {@link #getUnits()}and {@link #get(TemporalUnit)}.
+ * {@code long}, exposed via {@link #getUnits()} and {@link #get(TemporalUnit)}.
  * A simple case might have a single unit-value pair, such as "6 hours".
  * A more complex case may have multiple unit-value pairs, such as
  * "7 years, 3 months and 5 days".
  * <p>
  * There are two common implementations.

@@ -109,13 +109,14 @@
      * Typically, the implementation would define additional units
      * as conversions for the convenience of developers.
      *
      * @param unit the {@code TemporalUnit} for which to return the value
      * @return the long value of the unit
-     * @throws DateTimeException if the {@code unit} is not supported
+     * @throws DateTimeException if a value for the unit cannot be obtained
+     * @throws UnsupportedTemporalTypeException if the {@code unit} is not supported
      */
-    public long get(TemporalUnit unit);
+    long get(TemporalUnit unit);
 
     /**
      * Returns the list of units uniquely defining the value of this TemporalAmount.
      * The list of {@code TemporalUnits} is defined by the implementation class.
      * The list is a snapshot of the units at the time {@code getUnits}

@@ -128,11 +129,11 @@
      * state of the object without omissions, overlaps or duplication.
      * The units are in order from longest duration to shortest.
      *
      * @return the List of {@code TemporalUnits}; not null
      */
-    public List<TemporalUnit> getUnits();
+    List<TemporalUnit> getUnits();
 
     /**
      * Adds to the specified temporal object.
      * <p>
      * Adds the amount to the specified temporal object using the logic

@@ -160,21 +161,21 @@
      * Instead, an adjusted copy of the original must be returned.
      * This provides equivalent, safe behavior for immutable and mutable temporal objects.
      * <p>
      * The input temporal object may be in a calendar system other than ISO.
      * Implementations may choose to document compatibility with other calendar systems,
-     * or reject non-ISO temporal objects by {@link Queries#chronology() querying the chronology}.
+     * or reject non-ISO temporal objects by {@link TemporalQuery#chronology() querying the chronology}.
      * <p>
      * This method may be called from multiple threads in parallel.
      * It must be thread-safe when invoked.
      *
      * @param temporal  the temporal object to add the amount to, not null
      * @return an object of the same observable type with the addition made, not null
      * @throws DateTimeException if unable to add
      * @throws ArithmeticException if numeric overflow occurs
      */
-    public Temporal addTo(Temporal temporal);
+    Temporal addTo(Temporal temporal);
 
     /**
      * Subtracts this object from the specified temporal object.
      * <p>
      * Subtracts the amount from the specified temporal object using the logic

@@ -202,17 +203,17 @@
      * Instead, an adjusted copy of the original must be returned.
      * This provides equivalent, safe behavior for immutable and mutable temporal objects.
      * <p>
      * The input temporal object may be in a calendar system other than ISO.
      * Implementations may choose to document compatibility with other calendar systems,
-     * or reject non-ISO temporal objects by {@link Queries#chronology() querying the chronology}.
+     * or reject non-ISO temporal objects by {@link TemporalQuery#chronology() querying the chronology}.
      * <p>
      * This method may be called from multiple threads in parallel.
      * It must be thread-safe when invoked.
      *
      * @param temporal  the temporal object to subtract the amount from, not null
      * @return an object of the same observable type with the subtraction made, not null
      * @throws DateTimeException if unable to subtract
      * @throws ArithmeticException if numeric overflow occurs
      */
-    public Temporal subtractFrom(Temporal temporal);
+    Temporal subtractFrom(Temporal temporal);
 }