public abstract class TextContext extends FormatContext
A context for plain text parsing/formatting. This context provides
the TextFormat
to parse/format objects
of any class. If not superseded, the text format for a class is specified
by the DefaultTextFormat
annotation.
A default format exists for the following predefined types:
Modifier | Constructor and Description |
---|---|
protected |
TextContext()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
static TextContext |
enter()
Enters and returns a new text context instance.
|
static <T> TextFormat<T> |
getFormat(Class<? extends T> type)
Returns the text format for the specified type or
null
if none. |
static <T> T |
parse(CharSequence csq,
Class<T> type)
Returns the object corresponding to the specified textual representation
using the text format for the specified type (convenience method).
|
protected abstract <T> TextFormat<T> |
searchFormat(Class<? extends T> type)
Searches the plain text format for the specified type in this context.
|
abstract <T> void |
setFormat(Class<? extends T> type,
TextFormat<T> newFormat)
Sets the text format for the specified type (and its sub-types).
|
static String |
toString(Object obj)
Returns the string representation of the specified object using
its current format (convenience method).
|
current, current, enter, enterInner, exit, getOuter, inherit, inner
public static TextContext enter()
public static String toString(Object obj)
Object#12345
).public static <T> T parse(CharSequence csq, Class<T> type)
UnsupportedOperationException
- if the specified type has no
format associated.public static <T> TextFormat<T> getFormat(Class<? extends T> type)
null
if none.public abstract <T> void setFormat(Class<? extends T> type, TextFormat<T> newFormat)
protected abstract <T> TextFormat<T> searchFormat(Class<? extends T> type)
Copyright © 2005-2013 Javolution. All Rights Reserved.