private static void time(DateTimeFormatterBuilder bld,Collection<DateTimeFieldType> fields,boolean extended,boolean strictISO,boolean reducedPrec,boolean datePresent){
  boolean hour=fields.remove(DateTimeFieldType.hourOfDay());
  boolean minute=fields.remove(DateTimeFieldType.minuteOfHour());
  boolean second=fields.remove(DateTimeFieldType.secondOfMinute());
  boolean milli=fields.remove(DateTimeFieldType.millisOfSecond());
  if (!hour && !minute && !second&& !milli) {
    return;
  }
  if (hour || minute || second|| milli) {
    if (strictISO && reducedPrec) {
      throw new IllegalArgumentException("No valid ISO8601 format for fields because Date was reduced precision: " + fields);
    }
    if (datePresent) {
      bld.appendLiteral('T');
    }
  }
  if (hour && minute && second || (hour && !second && !milli)) {
  }
 else {
    if (strictISO && datePresent) {
      throw new IllegalArgumentException("No valid ISO8601 format for fields because Time was truncated: " + fields);
    }
    if (!hour && (minute && second || (minute && !milli) || second)) {
    }
 else {
      if (strictISO) {
        throw new IllegalArgumentException("No valid ISO8601 format for fields: " + fields);
      }
    }
  }
  if (hour) {
    bld.appendHourOfDay(2);
  }
 else   if (minute || second || milli) {
    bld.appendLiteral('-');
  }
  if (extended && hour && minute) {
    bld.appendLiteral(':');
  }
  if (minute) {
    bld.appendMinuteOfHour(2);
  }
 else   if (second || milli) {
    bld.appendLiteral('-');
  }
  if (extended && minute && second) {
    bld.appendLiteral(':');
  }
  if (second) {
    bld.appendSecondOfMinute(2);
  }
 else   if (milli) {
    bld.appendLiteral('-');
  }
  if (milli) {
    bld.appendLiteral('.');
    bld.appendMillisOfSecond(3);
  }
}

private static void time ( DateTimeFormatterBuilder bld , Collection < DateTimeFieldType > fields , boolean extended , boolean strictISO , boolean reducedPrec , boolean datePresent ) { boolean hour = fields . remove ( DateTimeFieldType . hourOfDay ( ) ) ; boolean minute = fields . remove ( DateTimeFieldType . minuteOfHour ( ) ) ; boolean second = fields . remove ( DateTimeFieldType . secondOfMinute ( ) ) ; boolean milli = fields . remove ( DateTimeFieldType . millisOfSecond ( ) ) ; if ( ! hour && ! minute && ! second && ! milli ) { return ; } if ( hour || minute || second || milli ) { if ( strictISO && reducedPrec ) { throw new IllegalArgumentException ( "No valid ISO8601 format for fields because Date was reduced precision: " + fields ) ; } if ( datePresent ) { bld . appendLiteral ( 'T' ) ; } } if ( hour && minute && second || ( hour && ! second && ! milli ) ) { } else { if ( strictISO && datePresent ) { throw new IllegalArgumentException ( "No valid ISO8601 format for fields because Time was truncated: " + fields ) ; } if ( ! hour && ( minute && second || ( minute && ! milli ) || second ) ) { } else { if ( strictISO ) { throw new IllegalArgumentException ( "No valid ISO8601 format for fields: " + fields ) ; } } } if ( hour ) { bld . appendHourOfDay ( 2 ) ; } else if ( minute || second || milli ) { bld . appendLiteral ( '-' ) ; } if ( extended && hour && minute ) { bld . appendLiteral ( ':' ) ; } if ( minute ) { bld . appendMinuteOfHour ( 2 ) ; } else if ( second || milli ) { bld . appendLiteral ( '-' ) ; } if ( extended && minute && second ) { bld . appendLiteral ( ':' ) ; } if ( second ) { bld . appendSecondOfMinute ( 2 ) ; } else if ( milli ) { bld . appendLiteral ( '-' ) ; } if ( milli ) { bld . appendLiteral ( '.' ) ; bld . appendMillisOfSecond ( 3 ) ; } }
adds the time fields to the builder . specification reference : 5 . 3 . 1 .
