|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.ui.declarative.DesignFormatter
public class DesignFormatter
Class focused on flexible and consistent formatting and parsing of different
values throughout reading and writing Design. An instance of this
class is used by DesignAttributeHandler.
| Constructor Summary | |
|---|---|
DesignFormatter()
Creates the formatter with default types already mapped. |
|
| Method Summary | ||
|---|---|---|
protected
|
addConverter(java.lang.Class<?> type,
Converter<java.lang.String,?> converter)
Adds a converter for a given type. |
|
protected
|
addConverter(Converter<java.lang.String,T> converter)
Adds a converter for a new type. |
|
boolean |
canConvert(java.lang.Class<?> type)
Checks whether or not a value of a given type can be converted. |
|
protected
|
findConverterFor(java.lang.Class<? extends T> sourceType)
Finds a converter for a given type. |
|
protected
|
findConverterFor(java.lang.Class<? extends T> sourceType,
boolean strict)
Finds a converter for a given type. |
|
java.lang.String |
format(java.lang.Object object)
Finds a formatter for a given object and attempts to format it. |
|
|
format(T object,
java.lang.Class<? extends T> type)
Formats an object according to a converter suitable for a given type. |
|
protected java.util.Set<java.lang.Class<?>> |
getRegisteredClasses()
Returns a set of classes that have a converter registered. |
|
protected void |
mapDefaultTypes()
Maps default types to their converters. |
|
|
parse(java.lang.String value,
java.lang.Class<? extends T> type)
Parses a given string as a value of given type |
|
protected void |
removeConverter(java.lang.Class<?> type)
Removes the converter for given type, if it was present. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DesignFormatter()
| Method Detail |
|---|
protected void mapDefaultTypes()
protected <T> void addConverter(Converter<java.lang.String,T> converter)
converter - Converter to add.
protected <T> void addConverter(java.lang.Class<?> type,
Converter<java.lang.String,?> converter)
type - Type to convert to/from.converter - Converter.protected void removeConverter(java.lang.Class<?> type)
type - Type to remove converter for.protected java.util.Set<java.lang.Class<?>> getRegisteredClasses()
public <T> T parse(java.lang.String value,
java.lang.Class<? extends T> type)
value - String value to convert.type - Expected result type.
public java.lang.String format(java.lang.Object object)
object - Object to format.
public <T> java.lang.String format(T object,
java.lang.Class<? extends T> type)
object - Object to format.type - Type of the object.
public boolean canConvert(java.lang.Class<?> type)
type - Type to check.
protected <T> Converter<java.lang.String,T> findConverterFor(java.lang.Class<? extends T> sourceType,
boolean strict)
strict is false.
sourceType - Type to find a converter for.strict - Whether or not search should be strict. When this is
false, a converter for a superclass of given type may
be returned.
protected <T> Converter<java.lang.String,T> findConverterFor(java.lang.Class<? extends T> sourceType)
sourceType - Type to find a converter for.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||