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

Print this page




 531         this.rangeUnit = rangeUnit;
 532         this.range = range;
 533         this.displayNameKey = displayNameKey;
 534     }
 535 
 536     //-----------------------------------------------------------------------
 537     @Override
 538     public String getName() {
 539         return name;
 540     }
 541 
 542     @Override
 543     public String getDisplayName(Locale locale) {
 544         Objects.requireNonNull(locale, "locale");
 545         if (displayNameKey == null) {
 546             return getName();
 547         }
 548 
 549         LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
 550                                     .getLocaleResources(locale);
 551         ResourceBundle rb = lr.getFormatData();
 552         String key = "field." + displayNameKey;
 553         return rb.containsKey(key) ? rb.getString(key) : getName();
 554     }
 555 
 556     @Override
 557     public TemporalUnit getBaseUnit() {
 558         return baseUnit;
 559     }
 560 
 561     @Override
 562     public TemporalUnit getRangeUnit() {
 563         return rangeUnit;
 564     }
 565 
 566     /**
 567      * Gets the range of valid values for the field.
 568      * <p>
 569      * All fields can be expressed as a {@code long} integer.
 570      * This method returns an object that describes the valid range for that value.
 571      * <p>




 531         this.rangeUnit = rangeUnit;
 532         this.range = range;
 533         this.displayNameKey = displayNameKey;
 534     }
 535 
 536     //-----------------------------------------------------------------------
 537     @Override
 538     public String getName() {
 539         return name;
 540     }
 541 
 542     @Override
 543     public String getDisplayName(Locale locale) {
 544         Objects.requireNonNull(locale, "locale");
 545         if (displayNameKey == null) {
 546             return getName();
 547         }
 548 
 549         LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
 550                                     .getLocaleResources(locale);
 551         ResourceBundle rb = lr.getJavaTimeFormatData();
 552         String key = "field." + displayNameKey;
 553         return rb.containsKey(key) ? rb.getString(key) : getName();
 554     }
 555 
 556     @Override
 557     public TemporalUnit getBaseUnit() {
 558         return baseUnit;
 559     }
 560 
 561     @Override
 562     public TemporalUnit getRangeUnit() {
 563         return rangeUnit;
 564     }
 565 
 566     /**
 567      * Gets the range of valid values for the field.
 568      * <p>
 569      * All fields can be expressed as a {@code long} integer.
 570      * This method returns an object that describes the valid range for that value.
 571      * <p>