Package org.lukashian
Class Formatter
java.lang.Object
org.lukashian.Formatter
Provides methods for formatting instances of the Lukashian Calendar classes. This implementation is not as sophisticated as the Java formatting classes, but
should provide sufficient functionality for most use cases.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
format
(org.apache.commons.numbers.fraction.BigFraction proportionOfDay) Formats the given time by transforming it into an integer number between 0 (inclusive) and 9999 (inclusive), see Basis Points.static String
format
(org.apache.commons.numbers.fraction.BigFraction proportionOfDay, Function<org.apache.commons.numbers.fraction.BigFraction, String> formatter) Formats the given time, using the givenFunction
.static String
Formats the givenDay
withFormatter.DayFormat.YEAR_FIRST
and '-' as a separator.static String
format
(Day day, Formatter.DayFormat format) Formats the givenDay
, according to the givenFormatter.DayFormat
, with '-' as a separator.static String
format
(Day day, Formatter.DayFormat format, String separator) Formats the givenDay
according to the givenFormatter.DayFormat
, using the given separator between the day and the year.static String
Formats the givenInstant
usingformat(Day)
andformat(BigFraction)
, using a space to separate the two.static String
format
(Instant instant, Formatter.DayFormat dayFormat, String daySeparator, Function<org.apache.commons.numbers.fraction.BigFraction, String> formatter) Formats the givenInstant
usingformat(Day, DayFormat, String)
andformat(BigFraction, Function)
, using a space to separate the two.static String
format
(Instant instant, Formatter.DayFormat dayFormat, Function<org.apache.commons.numbers.fraction.BigFraction, String> formatter) Formats the givenInstant
usingformat(Day, DayFormat)
andformat(BigFraction, Function)
, using a space to separate the two.static String
Formats the given year by simply returning the year as aString
.
-
Constructor Details
-
Formatter
public Formatter()
-
-
Method Details
-
format
Formats the given year by simply returning the year as aString
. -
format
Formats the givenDay
according to the givenFormatter.DayFormat
, using the given separator between the day and the year. IfFormatter.DayFormat.EPOCH
orFormatter.DayFormat.DAY_ONLY
is chosen, then the separator is not used. -
format
Formats the givenDay
, according to the givenFormatter.DayFormat
, with '-' as a separator. IfFormatter.DayFormat.EPOCH
orFormatter.DayFormat.DAY_ONLY
is chosen, then the separator is not used. -
format
Formats the givenDay
withFormatter.DayFormat.YEAR_FIRST
and '-' as a separator. -
format
public static String format(org.apache.commons.numbers.fraction.BigFraction proportionOfDay, Function<org.apache.commons.numbers.fraction.BigFraction, String> formatter) Formats the given time, using the givenFunction
. -
format
Formats the given time by transforming it into an integer number between 0 (inclusive) and 9999 (inclusive), see Basis Points.For a detailed explanation on how the proportion is interpreted, see
Instant.getBeeps()
. -
format
public static String format(Instant instant, Formatter.DayFormat dayFormat, String daySeparator, Function<org.apache.commons.numbers.fraction.BigFraction, String> formatter) Formats the givenInstant
usingformat(Day, DayFormat, String)
andformat(BigFraction, Function)
, using a space to separate the two. -
format
public static String format(Instant instant, Formatter.DayFormat dayFormat, Function<org.apache.commons.numbers.fraction.BigFraction, String> formatter) Formats the givenInstant
usingformat(Day, DayFormat)
andformat(BigFraction, Function)
, using a space to separate the two. -
format
Formats the givenInstant
usingformat(Day)
andformat(BigFraction)
, using a space to separate the two.
-