< prev index next >
src/java.base/share/classes/java/time/chrono/JapaneseEra.java
Print this page
rev 52293 : [mq]: 8212941
@@ -90,10 +90,12 @@
* <p>
* This class defines the valid eras for the Japanese chronology.
* Japan introduced the Gregorian calendar starting with Meiji 6.
* Only Meiji and later eras are supported;
* dates before Meiji 6, January 1 are not supported.
+ * The number of the valid eras may increase, as new eras may be
+ * defined by the Japanese government.
*
* @implSpec
* This class is immutable and thread-safe.
*
* @since 1.8
@@ -193,13 +195,17 @@
//-----------------------------------------------------------------------
/**
* Obtains an instance of {@code JapaneseEra} from an {@code int} value.
* <p>
- * The {@link #SHOWA} era that contains 1970-01-01 (ISO calendar system) has the value 1
+ * The {@link #SHOWA} era that contains 1970-01-01 (ISO calendar system) has the value 1.
* Later era is numbered 2 ({@link #HEISEI}). Earlier eras are numbered 0 ({@link #TAISHO}),
* -1 ({@link #MEIJI}), only Meiji and later eras are supported.
+ * <p>
+ * In addition to the known era singletons, values for additional
+ * eras may be defined. Those values are the {@link Era#getValue()}
+ * of corresponding eras from the {@link #values()} method.
*
* @param japaneseEra the era to represent
* @return the {@code JapaneseEra} singleton, not null
* @throws DateTimeException if the value is invalid
*/
@@ -214,10 +220,12 @@
/**
* Returns the {@code JapaneseEra} with the name.
* <p>
* The string must match exactly the name of the era.
* (Extraneous whitespace characters are not permitted.)
+ * <p>
+ * Valid era names are the names of eras returned from {@link #values()}.
*
* @param japaneseEra the japaneseEra name; non-null
* @return the {@code JapaneseEra} singleton, never null
* @throws IllegalArgumentException if there is not JapaneseEra with the specified name
*/
@@ -230,11 +238,13 @@
}
throw new IllegalArgumentException("japaneseEra is invalid");
}
/**
- * Returns an array of JapaneseEras.
+ * Returns an array of JapaneseEras. The array may contain eras defined
+ * by the Japanese government beyond the known era singletons.
+ *
* <p>
* This method may be used to iterate over the JapaneseEras as follows:
* <pre>
* for (JapaneseEra c : JapaneseEra.values())
* System.out.println(c);
< prev index next >