|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.binding.format.support.AbstractFormatter
public abstract class AbstractFormatter
Abstract base class for all formatters.
| Constructor Summary | |
|---|---|
protected |
AbstractFormatter()
Constructs a formatter. |
protected |
AbstractFormatter(boolean allowEmpty)
Constructs a formatter. |
| Method Summary | |
|---|---|
protected abstract java.lang.String |
doFormatValue(java.lang.Object value)
Template method subclasses should override to encapsulate formatting logic. |
protected abstract java.lang.Object |
doParseValue(java.lang.String formattedString,
java.lang.Class targetClass)
Template method subclasses should override to encapsulate parsing logic. |
java.lang.String |
formatValue(java.lang.Object value)
Format the value. |
protected java.lang.String |
getEmptyFormattedValue()
Returns the formatted form of an empty value. |
protected java.lang.Object |
getEmptyValue()
Returns the empty value (resulting from parsing an empty input string). |
protected java.lang.String |
getExpectedFormat(java.lang.Class targetClass)
Returns the expected string format for the given target class. |
boolean |
isAllowEmpty()
Allow formatting of empty (null or blank) values? |
protected boolean |
isEmpty(java.lang.Object o)
Is given object empty (null or empty string)? |
java.lang.Object |
parseValue(java.lang.String formattedString,
java.lang.Class targetClass)
Parse the formatted string representation of a value, restoring the value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractFormatter()
protected AbstractFormatter(boolean allowEmpty)
allowEmpty - allow formatting of empty (null or blank) values?| Method Detail |
|---|
public boolean isAllowEmpty()
public final java.lang.String formatValue(java.lang.Object value)
Formatter
formatValue in interface Formattervalue - the value to format
protected abstract java.lang.String doFormatValue(java.lang.Object value)
value - the value to format
protected java.lang.String getEmptyFormattedValue()
public final java.lang.Object parseValue(java.lang.String formattedString,
java.lang.Class targetClass)
throws InvalidFormatException
Formatter
parseValue in interface FormatterformattedString - the formatted string representationtargetClass - the target class to convert the formatted value to
InvalidFormatException - the string was in an invalid form
protected abstract java.lang.Object doParseValue(java.lang.String formattedString,
java.lang.Class targetClass)
throws InvalidFormatException,
java.text.ParseException
formattedString - the formatted string to parse
InvalidFormatException - an exception occured parsing
java.text.ParseException - when parse exceptions occurprotected java.lang.Object getEmptyValue()
protected java.lang.String getExpectedFormat(java.lang.Class targetClass)
protected boolean isEmpty(java.lang.Object o)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||