V
- is the generic type of the actual value to format
.public abstract class AbstractLocalizableFormatter<V> extends AbstractFormatter<V> implements LocalizableFormatter<V>
LocalizableFormatter
interface.Constructor and Description |
---|
AbstractLocalizableFormatter()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doFormat(V value,
Appendable buffer) |
protected abstract void |
doFormat(V value,
Appendable buffer,
Locale locale) |
String |
format(V value)
This method formats the given
value . |
void |
format(V value,
Appendable buffer)
|
void |
format(V value,
Appendable buffer,
Locale locale)
|
String |
format(V value,
Locale locale)
This method formats the given
value for the given locale . |
protected Locale |
getDefaultLocale()
This method gets the default locale used if none is provided.
|
formatNull
public AbstractLocalizableFormatter()
protected Locale getDefaultLocale()
Locale.getDefault()
. May be
overridden to change.public String format(V value)
Formatter
value
. StringBuilder
buffer = new StringBuilder();format
(value, buffer); return buffer.toString();
public String format(V value, Locale locale)
LocalizableFormatter
value
for the given locale
. StringBuilder
buffer = new StringBuilder();format
(value, buffer, locale); return buffer.toString();
format
in interface LocalizableFormatter<V>
value
- is the value to format. May be null
.locale
- is the Locale
.value
is null
, a legal implementation will return "null"
or "".public void format(V value, Appendable buffer)
Formatter
format
in interface Formatter<V>
format
in class AbstractFormatter<V>
value
- is the value to format. May be null
.buffer
- is the Appendable
to append
the formatted value to.public void format(V value, Appendable buffer, Locale locale) throws RuntimeIoException
LocalizableFormatter
format
in interface LocalizableFormatter<V>
value
- is the value to format. May be null
.buffer
- is the Appendable
to append
the formatted value to.locale
- is the Locale
to use.RuntimeIoException
- if append
caused a IOException
.protected abstract void doFormat(V value, Appendable buffer, Locale locale) throws IOException
value
- is the value to format (not null
).buffer
- is the Appendable
to append
the formatted value to.locale
- is the Locale
.IOException
- if caused by append
.format(Object, Appendable, Locale)
protected void doFormat(V value, Appendable buffer) throws IOException
doFormat
in class AbstractFormatter<V>
value
- is the value to format (not null
).buffer
- is the Appendable
to append
the formatted value to.IOException
- if caused by append
.AbstractFormatter.format(Object, Appendable)
Copyright © 2001–2016 mmm-Team. All rights reserved.