protected void assemble(Fields fields) {
    if (getParam() == null) {
      // force init as used below
      fields.eras = UnsupportedDurationField.getInstance(DurationFieldType.eras());

      // julian chrono removed zero, but we need to put it back
      DateTimeField field = fields.year;
      fields.year =
          new OffsetDateTimeField(new SkipUndoDateTimeField(this, field), BUDDHIST_OFFSET);

      // one era, so yearOfEra is the same
      field = fields.yearOfEra;
      fields.yearOfEra =
          new DelegatedDateTimeField(fields.year, fields.eras, DateTimeFieldType.yearOfEra());

      // julian chrono removed zero, but we need to put it back
      field = fields.weekyear;
      fields.weekyear =
          new OffsetDateTimeField(new SkipUndoDateTimeField(this, field), BUDDHIST_OFFSET);

      field = new OffsetDateTimeField(fields.yearOfEra, 99);
      fields.centuryOfEra =
          new DividedDateTimeField(field, fields.eras, DateTimeFieldType.centuryOfEra(), 100);
      fields.centuries = fields.centuryOfEra.getDurationField();

      field = new RemainderDateTimeField((DividedDateTimeField) fields.centuryOfEra);
      fields.yearOfCentury = new OffsetDateTimeField(field, DateTimeFieldType.yearOfCentury(), 1);

      field =
          new RemainderDateTimeField(
              fields.weekyear, fields.centuries, DateTimeFieldType.weekyearOfCentury(), 100);
      fields.weekyearOfCentury =
          new OffsetDateTimeField(field, DateTimeFieldType.weekyearOfCentury(), 1);

      fields.era = ERA_FIELD;
    }
  }
 public DurationField getDurationField() {
   return UnsupportedDurationField.getInstance(DurationFieldType.eras());
 }
Example #3
0
 /**
  * Get the centuries duration field for this chronology.
  *
  * @return DurationField or UnsupportedDurationField if unsupported
  */
 public DurationField centuries() {
   return UnsupportedDurationField.getInstance(DurationFieldType.centuries());
 }
Example #4
0
 /**
  * Get the years duration field for this chronology.
  *
  * @return DurationField or UnsupportedDurationField if unsupported
  */
 public DurationField years() {
   return UnsupportedDurationField.getInstance(DurationFieldType.years());
 }
Example #5
0
 /**
  * Get the months duration field for this chronology.
  *
  * @return DurationField or UnsupportedDurationField if unsupported
  */
 public DurationField months() {
   return UnsupportedDurationField.getInstance(DurationFieldType.months());
 }
Example #6
0
 /**
  * Get the weeks duration field for this chronology.
  *
  * @return DurationField or UnsupportedDurationField if unsupported
  */
 public DurationField weeks() {
   return UnsupportedDurationField.getInstance(DurationFieldType.weeks());
 }
Example #7
0
 /**
  * Get the halfdays duration field for this chronology.
  *
  * @return DurationField or UnsupportedDurationField if unsupported
  */
 public DurationField halfdays() {
   return UnsupportedDurationField.getInstance(DurationFieldType.halfdays());
 }
Example #8
0
 /**
  * Get the seconds duration field for this chronology.
  *
  * @return DurationField or UnsupportedDurationField if unsupported
  */
 public DurationField seconds() {
   return UnsupportedDurationField.getInstance(DurationFieldType.seconds());
 }