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

Print this page

        

@@ -55,10 +55,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 package java.time.temporal;
 
 import java.time.Duration;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoLocalDateTime;
+import java.time.chrono.ChronoZonedDateTime;
 
 /**
  * A standard set of date periods units.
  * <p>
  * This set of units provide unit-based access to manipulate a date, time or date-time.

@@ -252,33 +255,33 @@
         return this.compareTo(DAYS) < 0;
     }
 
     //-----------------------------------------------------------------------
     @Override
-    public boolean isSupported(Temporal temporal) {
+    public boolean isSupportedBy(Temporal temporal) {
         if (this == FOREVER) {
             return false;
         }
         if (temporal instanceof ChronoLocalDate) {
             return isDateUnit();
         }
         if (temporal instanceof ChronoLocalDateTime || temporal instanceof ChronoZonedDateTime) {
             return true;
         }
-        return TemporalUnit.super.isSupported(temporal);
+        return TemporalUnit.super.isSupportedBy(temporal);
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public <R extends Temporal> R doPlus(R dateTime, long periodToAdd) {
-        return (R) dateTime.plus(periodToAdd, this);
+    public <R extends Temporal> R addTo(R temporal, long amount) {
+        return (R) temporal.plus(amount, this);
     }
 
     //-----------------------------------------------------------------------
     @Override
-    public <R extends Temporal> SimplePeriod between(R dateTime1, R dateTime2) {
-        return new SimplePeriod(dateTime1.periodUntil(dateTime2, this), this);
+    public long between(Temporal temporal1, Temporal temporal2) {
+        return temporal1.periodUntil(temporal2, this);
     }
 
     //-----------------------------------------------------------------------
     @Override
     public String toString() {