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 Stringformat(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 Stringformat(org.apache.commons.numbers.fraction.BigFraction proportionOfDay, Function<org.apache.commons.numbers.fraction.BigFraction, String> formatter) Formats the given time, using the givenFunction.static StringFormats the givenDaywithFormatter.DayFormat.YEAR_FIRSTand '-' as a separator.static Stringformat(Day day, Formatter.DayFormat format) Formats the givenDay, according to the givenFormatter.DayFormat, with '-' as a separator.static Stringformat(Day day, Formatter.DayFormat format, String separator) Formats the givenDayaccording to the givenFormatter.DayFormat, using the given separator between the day and the year.static StringFormats the givenInstantusingformat(Day)andformat(BigFraction), using a space to separate the two.static Stringformat(Instant instant, Formatter.DayFormat dayFormat, String daySeparator, Function<org.apache.commons.numbers.fraction.BigFraction, String> formatter) Formats the givenInstantusingformat(Day, DayFormat, String)andformat(BigFraction, Function), using a space to separate the two.static Stringformat(Instant instant, Formatter.DayFormat dayFormat, Function<org.apache.commons.numbers.fraction.BigFraction, String> formatter) Formats the givenInstantusingformat(Day, DayFormat)andformat(BigFraction, Function), using a space to separate the two.static StringFormats 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 givenDayaccording to the givenFormatter.DayFormat, using the given separator between the day and the year. IfFormatter.DayFormat.EPOCHorFormatter.DayFormat.DAY_ONLYis chosen, then the separator is not used. -
format
Formats the givenDay, according to the givenFormatter.DayFormat, with '-' as a separator. IfFormatter.DayFormat.EPOCHorFormatter.DayFormat.DAY_ONLYis chosen, then the separator is not used. -
format
Formats the givenDaywithFormatter.DayFormat.YEAR_FIRSTand '-' 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 givenInstantusingformat(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 givenInstantusingformat(Day, DayFormat)andformat(BigFraction, Function), using a space to separate the two. -
format
Formats the givenInstantusingformat(Day)andformat(BigFraction), using a space to separate the two.
-