< prev index next >

src/java.base/share/classes/java/time/chrono/ChronoPeriodImpl.java

Print this page




  92  * @since 1.8
  93  */
  94 final class ChronoPeriodImpl
  95         implements ChronoPeriod, Serializable {
  96     // this class is only used by JDK chronology implementations and makes assumptions based on that fact
  97 
  98     /**
  99      * Serialization version.
 100      */
 101     @java.io.Serial
 102     private static final long serialVersionUID = 57387258289L;
 103 
 104     /**
 105      * The set of supported units.
 106      */
 107     private static final List<TemporalUnit> SUPPORTED_UNITS = List.of(YEARS, MONTHS, DAYS);
 108 
 109     /**
 110      * The chronology.
 111      */

 112     private final Chronology chrono;
 113     /**
 114      * The number of years.
 115      */
 116     final int years;
 117     /**
 118      * The number of months.
 119      */
 120     final int months;
 121     /**
 122      * The number of days.
 123      */
 124     final int days;
 125 
 126     /**
 127      * Creates an instance.
 128      */
 129     ChronoPeriodImpl(Chronology chrono, int years, int months, int days) {
 130         Objects.requireNonNull(chrono, "chrono");
 131         this.chrono = chrono;




  92  * @since 1.8
  93  */
  94 final class ChronoPeriodImpl
  95         implements ChronoPeriod, Serializable {
  96     // this class is only used by JDK chronology implementations and makes assumptions based on that fact
  97 
  98     /**
  99      * Serialization version.
 100      */
 101     @java.io.Serial
 102     private static final long serialVersionUID = 57387258289L;
 103 
 104     /**
 105      * The set of supported units.
 106      */
 107     private static final List<TemporalUnit> SUPPORTED_UNITS = List.of(YEARS, MONTHS, DAYS);
 108 
 109     /**
 110      * The chronology.
 111      */
 112     @SuppressWarnings("serial") // Not statically typed as Serializable
 113     private final Chronology chrono;
 114     /**
 115      * The number of years.
 116      */
 117     final int years;
 118     /**
 119      * The number of months.
 120      */
 121     final int months;
 122     /**
 123      * The number of days.
 124      */
 125     final int days;
 126 
 127     /**
 128      * Creates an instance.
 129      */
 130     ChronoPeriodImpl(Chronology chrono, int years, int months, int days) {
 131         Objects.requireNonNull(chrono, "chrono");
 132         this.chrono = chrono;


< prev index next >