Klasse AbstractParameterFormatter<T>
- Typparameter:
T
- parameter type
- Alle implementierten Schnittstellen:
ParameterFormatter
- Bekannte direkte Unterklassen:
AbstractListFormatter
,AbstractMultiSelectFormatter
,AbstractSingleTypeParameterFormatter
,BitsFormatter
,ClipFormatter
,FileSizeFormatter
,GeoFormatter
,NodeFormatter
,NumberFormatter
,TemporalFormatter
null
values and is suitable for
most parameter formatters.
Method format(FormatterContext, Object)
takes care of mapping null
and empty values. It does
so for both the value to be formatted and the formatted text returned by
formatValue(FormatterContext, Object)
.
If a null
or empty value is matched in the parameter configuration (e.g.
%{val,null:'no text',empty:'empty text'}
) the associated message is returned.
If no match was found for null
then nullText()
is returned.
Non-null
values are delegated to formatValue(FormatterContext, Object)
. The returned text will
be matched against null
and empty parameter configuration entries and is replaced by the best matching
message found.
- Seit:
- 0.3.1
-
Verschachtelte Klassen - Übersicht
Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen de.sayayi.lib.message.formatter.ParameterFormatter
ParameterFormatter.ComparatorContext, ParameterFormatter.ConfigKeyComparator<T>, ParameterFormatter.DefaultFormatter, ParameterFormatter.SizeQueryable
-
Feldübersicht
Von Schnittstelle geerbte Felder de.sayayi.lib.message.formatter.ParameterFormatter
NULL_TYPE
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungfinal @NotNull MessagePart.Text
format
(@NotNull FormatterContext context, Object value) Formats the parameter value to a string representation.protected abstract @NotNull MessagePart.Text
formatValue
(@NotNull FormatterContext context, T value) Formatvalue
usingcontext
.Von Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Von Schnittstelle geerbte Methoden de.sayayi.lib.message.formatter.ParameterFormatter
formatEmpty, formatNull, formatUsingMappedNumber, formatUsingMappedString, getFormattableTypes
-
Konstruktordetails
-
AbstractParameterFormatter
public AbstractParameterFormatter()
-
-
Methodendetails
-
format
@NotNull public final @NotNull MessagePart.Text format(@NotNull @NotNull FormatterContext context, Object value) Beschreibung aus Schnittstelle kopiert:ParameterFormatter
Formats the parameter value to a string representation.- Angegeben von:
format
in SchnittstelleParameterFormatter
- Parameter:
context
- message context providing formatting information, nevernull
value
- parameter value (can benull
)- Gibt zurück:
- formatted parameter value, never
null
-
formatValue
@NotNull protected abstract @NotNull MessagePart.Text formatValue(@NotNull @NotNull FormatterContext context, @NotNull T value) Formatvalue
usingcontext
.This method differs from
format(FormatterContext, Object)
in that it has already handledempty
andnull
cases matched in the parameter configuration.In the same way it will handle
empty
andnull
cases for the text returned by this method.- Parameter:
context
- formatter context, notnull
value
- value to be formatted, notnull
- Gibt zurück:
- formatted text, never
null
-