コード例 #1
0
 @Override
 public TimestampFormatter get() {
   TimestamperConfig config = GlobalConfiguration.all().get(TimestamperConfig.class);
   // JENKINS-16778: The request can be null when the slave goes off-line.
   Optional<StaplerRequest> request = Optional.fromNullable(Stapler.getCurrentRequest());
   Optional<String> timeZoneId =
       Optional.fromNullable(System.getProperty(TIME_ZONE_PROPERTY));
   return new TimestampFormatter(
       config.getSystemTimeFormat(), config.getElapsedTimeFormat(), request, timeZoneId);
 }
コード例 #2
0
 @Override
 public TimestampFormatter apply(@Nonnull StaplerRequest request) {
   TimestamperConfig config = GlobalConfiguration.all().get(TimestamperConfig.class);
   return new TimestampFormatterImpl(
       config.getSystemTimeFormat(), config.getElapsedTimeFormat(), request);
 }
コード例 #3
0
 /**
  * Returns the Timestamper config instance if Jenkins is present. For UnitTests a MOCK is
  * returned.
  *
  * @return the Timestamper config instance.
  */
 public static TimestamperConfig get() {
   return GlobalConfiguration.all().get(TimestamperConfig.class);
 }