|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.javatools.marshal.ToStringManager
public final class ToStringManager
Class that helps manage the conversion of objects to and from a String representation. The mechanisms that are available to perform this conversion are attempted in the following order:
toString() to go from Object to String and use the constructor that takes a single String parameter to go from String to Object.ToStringManager. If one is found, use its toString() and fromString() methods for carrying out the conversion.If none of these methods is available, then no interconversion with String is possible for the given object, and any attempt to perform the conversion will result in an UnsupportedOperationException being thrown.
| Method Summary | |
|---|---|
static boolean |
converterAvailable(java.lang.Class type)Returns true if the given class type can be converted to and from String for the purposes of persistence. |
static boolean |
converterAvailable(java.lang.Object object)Returns true if the value of the given object can be converted to and from a String representation. |
static boolean |
converterAvailable(java.lang.String typeStr)Invokes Class.forName() on the typeStr and then calls converterAvailable(Class). |
static java.lang.Object |
fromString(java.lang.String s, java.lang.Class targetClass)Converts the given String into the specified target class type, returning an instance that has been properly initialized according to the contents of the String. |
static boolean |
registerCustomConverter(java.lang.Class converterClass)Registers a class type as being able to interconvert an object type to and from String. |
static boolean |
registerStringConvertible(java.lang.Class clazz)Adds the specified class to the list of classes that have a direct String representation. |
static java.lang.String |
toString(java.lang.Object obj)Converts the given object to a String representation from which the instance can later be restored by invoking fromString(). |
static java.lang.String |
toString(java.lang.Object obj, java.lang.Class objClass)Converts the given object to a String representation, forcing the format to be that of the class objClass. |
static java.lang.Class |
wrapPrimitive(java.lang.Class primitive)If the primitive argument represents a primitive type, then the returned class is the corresponding object-wrapped type. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean registerStringConvertible(java.lang.Class clazz)
String representation.true if the class type has not already been registered as a constructor supported converter; false otherwise.public static boolean registerCustomConverter(java.lang.Class converterClass)
String. The class type passed in through converterClass must be declared as public and must supply three static methods that conform to the following:
public static Class supportedClass();Class that represents the object type that the converterClass is capable of interconverting to and from String.public static String toString( <supportedClass> );String.public static <supportedClass> fromString( String s );registerCustomConverter() will return false. If registration succeeds, registerCustomConverter() returns true.
Generally, the name of the class should end with 2String, but this is not enforced by ToStringManager.
public static java.lang.Class wrapPrimitive(java.lang.Class primitive)
primitive argument represents a primitive type, then the returned class is the corresponding object-wrapped type. Otherwise, the argument is returned as is.public static boolean converterAvailable(java.lang.Object object)
true if the value of the given object can be converted to and from a String representation. If the object parameter is null, then this method returns false.public static boolean converterAvailable(java.lang.String typeStr)
Class.forName() on the typeStr and then calls converterAvailable(Class).public static boolean converterAvailable(java.lang.Class type)
true if the given class type can be converted to and from String for the purposes of persistence. If the type parameter is null, then this method returns false.public static java.lang.String toString(java.lang.Object obj)
String representation from which the instance can later be restored by invoking fromString().
public static java.lang.String toString(java.lang.Object obj,
java.lang.Class objClass)
String representation, forcing the format to be that of the class objClass.
public static java.lang.Object fromString(java.lang.String s,
java.lang.Class targetClass)
String into the specified target class type, returning an instance that has been properly initialized according to the contents of the String. The fromString() method should restore the object instance to its exact state at the time that the ToStringManager.toString() method was used to persist it.
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||