|
java.lang.Object com.kiwisoft.utils.format.DefaultObjectFormat
Default implementation of ObjectFormat
interface. Uses Object.toString()
to format the objects. This class can format all objects.
ObjectFormat
Field Summary |
Fields inherited from interface com.kiwisoft.utils.format.ObjectFormat |
DEFAULT |
Constructor Summary | |
DefaultObjectFormat(String name)
|
Method Summary | |
boolean |
canFormat(Class aClass)
Returns if this class can format object of the specified class. |
boolean |
canParse(Class aClass)
Returns if the format can create objects of the specified class from String objects. |
String |
format(Object value)
Returns the String representing the specified value. |
String |
getGroup()
The name of the group the format belongs to. |
int |
getHorizontalAlignment(Object value)
Returns the horizontal alignment of the formatted text. |
Icon |
getIcon(Object value)
Returns the icon for the specified value; |
String |
getName()
Returns the name of this format. |
Object |
parse(String value,
Class targetClass)
Returns the Object created from the specified String . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultObjectFormat(String name)
name
- The name of the format.Method Detail |
public String getName()
getName
in interface ObjectFormat
public String getGroup()
getGroup
in interface ObjectFormat
null
.public boolean canFormat(Class aClass)
canFormat
in interface ObjectFormat
aClass
- The class of the objects which should be formated.
true.- See Also:
format(Object)
public boolean canParse(Class aClass)
String
objects.
canParse
in interface ObjectFormat
aClass
- The class of the objects which should be created.
false.- See Also:
parse(String, Class)
public String format(Object value)
String
representing the specified value.
format
in interface TextFormat
value
- The object which should be formated.
null
if value
is null otherwise
the value of value.toString()
.ObjectFormat.canFormat(Class)
public Object parse(String value, Class targetClass)
Object
created from the specified String
.
parse
in interface TextFormat
value
- The String
which should be parsed.targetClass
- The Class
the return value should have. Can be ignored if
the format handles only one class.
UnsupportedOperationException
.ObjectFormat.canParse(Class)
public Icon getIcon(Object value)
getIcon
in interface TextFormat
value
- The unformated value.
null
.public int getHorizontalAlignment(Object value)
getHorizontalAlignment
in interface TextFormat
value
- The unformated value.
SwingConstants.LEADING
|
||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |