Enum Class DetailsMessageFormatters
java.lang.Object
java.lang.Enum<DetailsMessageFormatters>
io.github.venkateshamurthy.exceptional.exceptions.DetailsMessageFormatters
- All Implemented Interfaces:
Serializable,Comparable<DetailsMessageFormatters>,Constable
An enumeration of Message formatters that can be used to format the detail message.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA apache commons style ${somekey} pattern.A double angular braces <<>> marker.A Standard Java style MessageFormat pattern - just the way printf works.A named {key} pattern which would be replaced by a mapped value from a key-value map.A no/none formatting enum to be used as a catch-all default if no other pattern works.A SLF4J logger style empty braces pattern. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdetectAndFormat(String template, Object... values) A convenient static method to determine format and formatstatic DetailsMessageFormattersdetectFormatter(String template) A detection of formatter given a templateabstract StringMethod to format a given template and values.static DetailsMessageFormattersReturns the enum constant of this class with the specified name.static DetailsMessageFormatters[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
A no/none formatting enum to be used as a catch-all default if no other pattern works. -
SLF4J
A SLF4J logger style empty braces pattern. -
DOUBLEANGULAR
A double angular braces <<>> marker. -
$BRACES
A apache commons style ${somekey} pattern. -
NAMEDARGS
A named {key} pattern which would be replaced by a mapped value from a key-value map. -
JAVA
A Standard Java style MessageFormat pattern - just the way printf works.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
format
Method to format a given template and values.- Parameters:
template- a marker-ed template where each marker style is specific to the instance'spatternvalues- could be var-arg style argument values that is allowed in all the formats. However it could just be a map (of key-value pairs) ifNAMEDARGSis used.- Returns:
- formatted string
-
detectFormatter
A detection of formatter given a template- Parameters:
template- to be introspected to know which formatter style works to replace values- Returns:
- the matching
DetailsMessageFormattersiff only one formatter matches. - Throws:
IllegalArgumentException- in case of no suitable formatter determined or multiple formatters matching.
-
detectAndFormat
A convenient static method to determine format and format- Parameters:
template- the string templatevalues- the values to replace- Returns:
- formated template with values (if required with
NONE).
-