protected void assemble(Fields fields) {
    if (getParam() == null) {
      // 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, 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, DateTimeFieldType.centuryOfEra(), 100);

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

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

      fields.era = ERA_FIELD;
    }
  }
示例#2
0
 /**
  * Get the year of era field for this chronology.
  *
  * @return DateTimeField or UnsupportedDateTimeField if unsupported
  */
 public DateTimeField yearOfEra() {
   return UnsupportedDateTimeField.getInstance(DateTimeFieldType.yearOfEra(), years());
 }
 /** Restricted constructor. */
 private ISOYearOfEraDateTimeField() {
   super(GregorianChronology.getInstanceUTC().year(), DateTimeFieldType.yearOfEra());
 }