@JStacheFormatter
@JStacheFormatterTypes(types={java.net.URI.class,java.net.URL.class})
public interface DefaultFormatter
extends Formatter
Default formatters.
Unlike the mustache spec it will throw a NPE trying to format null objects.
- Author:
- agentgt
-
Method Summary
Modifier and TypeMethodDescriptionFormats the object and then sends the results to the downstream appender.Formats the object and then sends the results to the downstream appender.static Formatter
of()
Provides the default formatter for static lookup.static Formatter
provider()
Provides the default formatter for static lookup.
-
Method Details
-
format
default <A extends Output<E>,E extends Exception> void format(Appender downstream, A a, String path, Class<?> c, @Nullable Object o) throws E Formats the object and then sends the results to the downstream appender. Will throw an NPE if parameter o isnull
.- Specified by:
format
in interfaceFormatter
- Type Parameters:
A
- the appendable typeE
- the appender exception type- Parameters:
downstream
- the downstream appender to be used instead of the appendable directlya
- the appendable to be passed to the appenderpath
- the dotted mustache like pathc
- the object class but is not guaranteed to be accurate. If it is not known Object.class will be used.o
- the object which maybe null- Throws:
E
- if the appender or appendable throws an exception
-
format
default <A extends Output<E>,E extends Exception> void format(Appender downstream, A a, String path, String s) throws E Formats the object and then sends the results to the downstream appender. The default implementation passes natives through to the downstream appender. Will throw an NPE if parameter s isnull
.- Specified by:
format
in interfaceFormatter
- Type Parameters:
A
- the appendable typeE
- the appender exception type- Parameters:
downstream
- the downstream appender to be used instead of the appendable directlya
- the appendable to be passed to the appenderpath
- the dotted mustache like paths
- String- Throws:
E
- if the appender or appendable throws an exception
-
provider
Provides the default formatter for static lookup.- Returns:
- the default formatter singleton
-
of
Provides the default formatter for static lookup.- Returns:
- the default formatter singleton
-