/** * Creates an instance of {@link ObjectGenerator} which converts specified instance of {@link ObjectGenerator} to * time format. For format options, see {@link java.time.format.DateTimeFormatter DateTimeFormatter}. * * @param format Format string. * @param generator Instance of {@link ObjectGenerator} which value will be formated to string. It must return * {@link Long}, {@link Date}, {@link LocalDate} or {@link LocalDateTime}. * @param <T> Type of value count pair contains. * @return An instance of {@link ObjectGenerator} which converts specified instance of {@link ObjectGenerator} to * time format. */ public static <T> ObjectGenerator<String> time(String format, ObjectGenerator<T> generator) { return wrap(new TimeFormatTransformer(format, generator.value)); }
/** * Creates an instance of {@link ObjectGenerator} which converts specified instance of {@link ObjectGenerator} to * time format. For format options, see {@link java.time.format.DateTimeFormatter DateTimeFormatter}. * * @param format Format string. * @param generator Instance of {@link ObjectGenerator} which value will be formated to string. It must return * {@link Long}, {@link Date}, {@link LocalDate} or {@link LocalDateTime}. * @param <T> Type of value count pair contains. * @return An instance of {@link ObjectGenerator} which converts specified instance of {@link ObjectGenerator} to * time format. */ public static <T> ObjectGenerator<String> time(String format, ObjectGenerator<T> generator) { return wrap(new TimeFormatTransformer(format, generator.value)); }
/** * Time format transformer definition. * * @return Time format transformer definition rule. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Rule timeFormatTransformer() { return Sequence(function("time", Sequence(stringLiteral(), comma(), value())), push(new TimeFormatTransformer((String) pop(1), (Value) pop()))); }
/** * Time format transformer definition. * * @return Time format transformer definition rule. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Rule timeFormatTransformer() { return Sequence(function("time", Sequence(stringLiteral(), comma(), value())), push(new TimeFormatTransformer((String) pop(1), (Value) pop()))); }