|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.util.ObjectStringConversion
public class ObjectStringConversion
This class serves as a basic implementation of the ObjectStringConverter
interface. It is capable of converting objects of different
types to Strings and vice versa.
It provides a default singleton instance that contains a great number of
different implementations for a variety of types.
getInstance()
| Constructor Summary | |
|---|---|
protected |
ObjectStringConversion()
Creates a new instance of ObjectStringConversion with no converters installed initially. |
| Method Summary | |
|---|---|
Object |
convertToObject(String o,
Class asClass)
This method takes a String, and tries to interpret it as a String representation of the given class type, which it will then create. |
String |
convertToString(Object o,
Class asClass)
This method takes an object, treats it as an object of the given class type and produces a String representation. |
ObjectStringConverter |
findObjectStringConverter(Class forClass)
|
static ObjectStringConversion |
getInstance()
Provides access to the singleton instance |
void |
registerAsSingleton()
Registers this instance as the singleton instance returned by getInstance(). |
protected void |
registerDefaultConverters()
Registers default implementations for this instance for a number of different classes and types including: Integer Float Double Byte Short Boolean Long int float double byte boolean short long String Color File Date Font URL Rectangle2D Point2D Class Locale |
void |
registerObjectStringConverter(Class clazz,
ObjectStringConverter s)
Registers another handler for the given class type |
ObjectStringConverter |
removeObjectStringConverter(Class forClass)
Removes a handler which was previously registered for the given class type |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ObjectStringConversion()
registerDefaultConverters()| Method Detail |
|---|
public void registerAsSingleton()
getInstance().
protected void registerDefaultConverters()
public void registerObjectStringConverter(Class clazz,
ObjectStringConverter s)
clazz - the type of classs - the converterpublic ObjectStringConverter removeObjectStringConverter(Class forClass)
forClass - the type of class
null if there was no such handler registeredpublic static ObjectStringConversion getInstance()
public Object convertToObject(String o,
Class asClass)
throws IllegalArgumentException
ObjectStringConverter
convertToObject in interface ObjectStringConverterIllegalArgumentException - if this method is not capable of doing the transformation because of illegal
argumentso - the String to convertasClass - the type which should be generated by this method. the method is
free to create a more specific type, but that type must be assignment compatible
public String convertToString(Object o,
Class asClass)
throws IllegalArgumentException
ObjectStringConverter
convertToString in interface ObjectStringConverterIllegalArgumentException - if this method is not capable of doing the transformation because of illegal
argumentso - the object to convertasClass - the type which should be used to interpret the object, may be less specific than
the actual object's type
public ObjectStringConverter findObjectStringConverter(Class forClass)
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||