com.codepulsar.nils.api.Formats Maven / Gradle / Ivy
Show all versions of nils-core Show documentation
package com.codepulsar.nils.api;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.time.format.DateTimeFormatter;
/**
* A Formats provides access to divers Java related formatter object.
*
* All are related to the Locale
used in a {@link NLS} object.
*
*
A Formats can be retrieved by calling {@link NLS#getFormats()}.
*/
public interface Formats {
/**
* Get a DateTimeFormatter
object for "temporal" dates like LocalDate
in
* the FormatStyle defined in {@link NilsConfig#getDateFormatStyle()}.
*
* @return A DateTimeFormatter
object for date.
*/
DateTimeFormatter forDate();
/**
* Get a DateTimeFormatter
object for "temporal" times like LocalTime
in
* the FormatStyle defined in {@link NilsConfig#getDateFormatStyle()}.
*
*
Note: Only FormatStyle.MEDIUM
and FormatStyle.SHORT
can be
* used for LocalTime object. Any other configuration of {@link NilsConfig#getDateFormatStyle()}
* will result in FormatStyle.MEDIUM
.
*
* @return A DateTimeFormatter
object for time.
*/
DateTimeFormatter forTime();
/**
* Get a DateTimeFormatter
object for "temporal" dates with time like
* LocalDateTime
in the FormatStyle defined in {@link NilsConfig#getDateFormatStyle()}.
*
* @return A DateTimeFormatter
object for date with time.
*/
DateTimeFormatter forDateTime();
/**
* Get a DateFormat
object for "util" Date
s with date information in the
* FormatStyle defined in {@link NilsConfig#getDateFormatStyle()}.
*
* @return A DateFormat
object for date.
*/
DateFormat forUtilDate();
/**
* Get a DateFormat
object for "util" Date
s with time information in the
* FormatStyle defined in {@link NilsConfig#getDateFormatStyle()}.
*
* @return A DateFormat
object for time.
*/
DateFormat forUtilTime();
/**
* Get a DateFormat
object for "util" Date
with date and time
* information in the FormatStyle defined in {@link NilsConfig#getDateFormatStyle()}.
*
* @return A DateFormat
object for date with time.
*/
DateFormat forUtilDateTime();
/**
* Get a NumberFormat
object for Number
s.
*
* @return A NumberFormat
object.
*/
NumberFormat forNumber();
/**
* Get a NumberFormat
object for formatting Number
s as currencies.
*
* @return A NumberFormat
object.
*/
NumberFormat forCurrency();
/**
* Get a NumberFormat
object for formatting Number
s as integer.
*
* @return A NumberFormat
object.
*/
NumberFormat forInteger();
/**
* Get a NumberFormat
object for formatting Number
s as percent values.
*
* @return A NumberFormat
object.
*/
NumberFormat forPercent();
/**
* Get a DecimalFormat
object for formatting Number
s as decimal values.
*
* @return A DecimalFormat
object.
*/
DecimalFormat forDecimal();
/**
* Get a DecimalFormatSymbols
object.
*
* @return A DecimalFormatSymbols
object.
*/
DecimalFormatSymbols decimalFormatSymbols();
}