public interface Formatter
Format a variable to something else. Useful for date/long conversion. etc.. A formatter is applied on simple mustache/handlebars expression, like: {{var}}, but not in block expression.
Usage:
Handlebars hbs = new Handlebars();
hbs.with(new Formatter() {
public Object format(Object value, Chain next) {
if (value instanceof Date) {
return ((Date) value).getTime();
}
return next.format(value);
}
});
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Formatter.Chain
Call the next formatter in the chain.
|
| Modifier and Type | Field and Description |
|---|---|
static Formatter.Chain |
NOOP
NOOP Formatter.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
format(java.lang.Object value,
Formatter.Chain next)
Format a value if possible or call next formatter in the chain.
|
static final Formatter.Chain NOOP
java.lang.Object format(java.lang.Object value,
Formatter.Chain next)
value - A value to format, or pass it to the next formatter in the chain.next - Point to the next formatter in the chain.Copyright © 2010 - 2023 Adobe. All Rights Reserved