Package com.guflimc.brick.i18n.api.time
Class DurationFormatterBuilder
java.lang.Object
com.guflimc.brick.i18n.api.time.DurationFormatterBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(BrickChronoField field, String format) Appends a format for the givenBrickChronoFieldto the resulting format.append(BrickChronoField field, String format, int flags) Appends a format for the givenBrickChronoFieldto the resulting format.append(BrickChronoField field, Function<Long, String> formatter) Appends a format for the givenBrickChronoFieldto the resulting format.append(BrickChronoField field, Function<Long, String> formatter, int flags) Appends a format for the givenBrickChronoFieldto the resulting format.build()Create a newDurationFormatterwith the previously added formats.postProcessor(@NotNull Function<String, String> postProcessor) Applies a post processor to the resulting format.
-
Constructor Details
-
DurationFormatterBuilder
public DurationFormatterBuilder()
-
-
Method Details
-
append
public DurationFormatterBuilder append(BrickChronoField field, Function<Long, String> formatter, int flags) Appends a format for the givenBrickChronoFieldto the resulting format. Extra flags may be applied to this field.- Parameters:
field- the chrono field to which this format appliesformatter- the formatter to use for this fieldflags- extra flags to apply to this field- Returns:
- this builder
-
append
Appends a format for the givenBrickChronoFieldto the resulting format. This also applies theDurationFormatter.FLAG_SKIP_OUT_OF_UPPER_BOUNDflag.- Parameters:
field- the chrono field to which this format appliesformatter- the formatter to use for this field- Returns:
- this builder
-
append
Appends a format for the givenBrickChronoFieldto the resulting format. Extra flags may be applied to this field.- Parameters:
field- the chrono field to which this format appliesformat- the format to use for this fieldflags- extra flags to apply to this field- Returns:
- this builder
-
append
Appends a format for the givenBrickChronoFieldto the resulting format. This also applies theDurationFormatter.FLAG_SKIP_OUT_OF_UPPER_BOUNDflag.- Parameters:
field- the chrono field to which this format appliesformat- the format to use for this field- Returns:
- this builder
-
postProcessor
public DurationFormatterBuilder postProcessor(@NotNull @NotNull Function<String, String> postProcessor) Applies a post processor to the resulting format.- Parameters:
postProcessor- the post processor to apply- Returns:
- this builder
-
build
Create a newDurationFormatterwith the previously added formats.- Returns:
- the new formatter
-