com.codemesh.terp.api
Class Formatter.TextFormatter
java.lang.Object
com.codemesh.terp.api.Transformer.AbstractTransformer<java.lang.CharSequence>
com.codemesh.terp.api.Formatter.AbstractFormatter
com.codemesh.terp.api.Formatter.TextFormatter
- All Implemented Interfaces:
- Formatter, Transformer<java.lang.CharSequence>
- Enclosing interface:
- Formatter
public static class Formatter.TextFormatter
- extends Formatter.AbstractFormatter
A formatter that applies a Java format string with optional
arguments to the item.
A Java format string is very similar to a C printf() format,
only more powerful. It supports more types and modifiers than
the printf() family of functions. An example is a Date format
that only renders the year: "%tY".
| Nested classes/interfaces inherited from interface com.codemesh.terp.api.Formatter |
Formatter.AbstractFormatter, Formatter.Base64, Formatter.Capitalize, Formatter.Namefy, Formatter.Pad, Formatter.Remove, Formatter.Replace, Formatter.TextFormatter, Formatter.ToAscii, Formatter.ToLowercase, Formatter.ToSlug, Formatter.ToUppercase, Formatter.ToXml, Formatter.Trim |
|
Method Summary |
java.lang.String |
transform(java.lang.Object item,
java.util.List<java.lang.Object> args,
TerpContext ctx)
Transforms an item into another item, taking optional arguments into account. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Formatter.TextFormatter
public Formatter.TextFormatter(java.lang.String format)
- Creates a Java text formatter with the given format string.
- Parameters:
format - the format string.
Formatter.TextFormatter
public Formatter.TextFormatter(java.lang.String format,
java.lang.String itemName)
Formatter.TextFormatter
public Formatter.TextFormatter(java.lang.String format,
java.lang.String itemName,
java.lang.String[] paramNames)
transform
public java.lang.String transform(java.lang.Object item,
java.util.List<java.lang.Object> args,
TerpContext ctx)
- Transforms an item into another item, taking optional arguments into account.
- Parameters:
item - the item to transform.args - the optional arguments.ctx - the context in which the transformation occurs.
- Returns:
- the transformed item.
Copyright © 2008-2012 by Codemesh, Inc. All Rights Reserved.