示例#1
0
 public static String formatSessoinPrefix(LogFilePrefix prefix) {
   return String.format(
       ENGLISH,
       "%d.%d%s@%s",
       prefix.getSiteId(),
       prefix.getProjectId(),
       prefix.getWorkflowName(),
       SESSION_TIME_FORMATTER.withZone(prefix.getTimeZone()).format(prefix.getSessionTime()));
 }
  public static DateTimeFormatter getDateTimeFormatter(ColumnDefinition<?, ?> columnDefinition) {
    DateTimeFormatter dtf;

    if (columnDefinition.has(JavaDateTimeFormatterProperty.class)) {
      dtf = columnDefinition.lookFor(JavaDateTimeFormatterProperty.class).getFormatter();
    } else if (columnDefinition.has(DateFormatProperty.class)) {
      dtf =
          DateTimeFormatter.ofPattern(
              columnDefinition.lookFor(DateFormatProperty.class).getPattern());
    } else {
      throw new IllegalArgumentException("No date format pattern specified");
    }

    final ZoneId zoneId = _getZoneId(columnDefinition);

    if (zoneId != null) {
      dtf = dtf.withZone(zoneId);
    } else if (dtf.getZone() == null) {
      dtf = dtf.withZone(ZoneId.systemDefault());
    }

    return dtf;
  }