protected void assemble(Fields fields) {
    fields.year = convertField(fields.year);
    fields.yearOfEra = convertField(fields.yearOfEra);
    fields.yearOfCentury = convertField(fields.yearOfCentury);
    fields.centuryOfEra = convertField(fields.centuryOfEra);
    fields.era = convertField(fields.era);
    fields.dayOfWeek = convertField(fields.dayOfWeek);
    fields.dayOfMonth = convertField(fields.dayOfMonth);
    fields.dayOfYear = convertField(fields.dayOfYear);
    fields.monthOfYear = convertField(fields.monthOfYear);
    fields.weekOfWeekyear = convertField(fields.weekOfWeekyear);
    fields.weekyear = convertField(fields.weekyear);
    fields.weekyearOfCentury = convertField(fields.weekyearOfCentury);

    fields.millisOfSecond = convertField(fields.millisOfSecond);
    fields.millisOfDay = convertField(fields.millisOfDay);
    fields.secondOfMinute = convertField(fields.secondOfMinute);
    fields.secondOfDay = convertField(fields.secondOfDay);
    fields.minuteOfHour = convertField(fields.minuteOfHour);
    fields.minuteOfDay = convertField(fields.minuteOfDay);
    fields.hourOfDay = convertField(fields.hourOfDay);
    fields.hourOfHalfday = convertField(fields.hourOfHalfday);
    fields.clockhourOfDay = convertField(fields.clockhourOfDay);
    fields.clockhourOfHalfday = convertField(fields.clockhourOfHalfday);
    fields.halfdayOfDay = convertField(fields.halfdayOfDay);
  }
  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;
    }
  }
  protected void assemble(Fields fields) {
    // Keep a local cache of converted fields so as not to create redundant
    // objects.
    HashMap<Object, Object> converted = new HashMap<Object, Object>();

    // Convert duration fields...

    fields.eras = convertField(fields.eras, converted);
    fields.centuries = convertField(fields.centuries, converted);
    fields.years = convertField(fields.years, converted);
    fields.months = convertField(fields.months, converted);
    fields.weekyears = convertField(fields.weekyears, converted);
    fields.weeks = convertField(fields.weeks, converted);
    fields.days = convertField(fields.days, converted);

    fields.halfdays = convertField(fields.halfdays, converted);
    fields.hours = convertField(fields.hours, converted);
    fields.minutes = convertField(fields.minutes, converted);
    fields.seconds = convertField(fields.seconds, converted);
    fields.millis = convertField(fields.millis, converted);

    // Convert datetime fields...

    fields.year = convertField(fields.year, converted);
    fields.yearOfEra = convertField(fields.yearOfEra, converted);
    fields.yearOfCentury = convertField(fields.yearOfCentury, converted);
    fields.centuryOfEra = convertField(fields.centuryOfEra, converted);
    fields.era = convertField(fields.era, converted);
    fields.dayOfWeek = convertField(fields.dayOfWeek, converted);
    fields.dayOfMonth = convertField(fields.dayOfMonth, converted);
    fields.dayOfYear = convertField(fields.dayOfYear, converted);
    fields.monthOfYear = convertField(fields.monthOfYear, converted);
    fields.weekOfWeekyear = convertField(fields.weekOfWeekyear, converted);
    fields.weekyear = convertField(fields.weekyear, converted);
    fields.weekyearOfCentury = convertField(fields.weekyearOfCentury, converted);

    fields.millisOfSecond = convertField(fields.millisOfSecond, converted);
    fields.millisOfDay = convertField(fields.millisOfDay, converted);
    fields.secondOfMinute = convertField(fields.secondOfMinute, converted);
    fields.secondOfDay = convertField(fields.secondOfDay, converted);
    fields.minuteOfHour = convertField(fields.minuteOfHour, converted);
    fields.minuteOfDay = convertField(fields.minuteOfDay, converted);
    fields.hourOfDay = convertField(fields.hourOfDay, converted);
    fields.hourOfHalfday = convertField(fields.hourOfHalfday, converted);
    fields.clockhourOfDay = convertField(fields.clockhourOfDay, converted);
    fields.clockhourOfHalfday = convertField(fields.clockhourOfHalfday, converted);
    fields.halfdayOfDay = convertField(fields.halfdayOfDay, converted);
  }
Example #4
0
  protected void assemble(Fields fields) {
    if (getBase().getZone() == DateTimeZone.UTC) {
      // Use zero based century and year of century.
      fields.centuryOfEra =
          new DividedDateTimeField(
              ISOYearOfEraDateTimeField.INSTANCE, DateTimeFieldType.centuryOfEra(), 100);
      fields.yearOfCentury =
          new RemainderDateTimeField(
              (DividedDateTimeField) fields.centuryOfEra, DateTimeFieldType.yearOfCentury());
      fields.weekyearOfCentury =
          new RemainderDateTimeField(
              (DividedDateTimeField) fields.centuryOfEra, DateTimeFieldType.weekyearOfCentury());

      fields.centuries = fields.centuryOfEra.getDurationField();
    }
  }