< prev index next >

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

Print this page
rev 17640 : [mq]: 8171049

*** 59,69 **** --- 59,74 ---- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package java.time.chrono; + import static java.time.temporal.ChronoField.ERA; + import java.time.DateTimeException; + import java.time.format.DateTimeFormatterBuilder; + import java.time.format.TextStyle; + import java.util.Locale; /** * An era in the Minguo calendar system. * <p> * The Minguo calendar system has two eras.
*** 151,156 **** --- 156,176 ---- @Override public int getValue() { return ordinal(); } + /** + * {@inheritDoc} + * + * @param style {@inheritDoc} + * @param locale {@inheritDoc} + */ + @Override + public String getDisplayName(TextStyle style, Locale locale) { + return new DateTimeFormatterBuilder() + .appendText(ERA, style) + .toFormatter(locale) + .withChronology(MinguoChronology.INSTANCE) + .format(this == ROC ? MinguoDate.of(1, 1, 1) : MinguoDate.of(0, 1, 1)); + } + }
< prev index next >