org.objectweb.jac.aspects.persistence
Class ValueConverter

java.lang.Object
  extended byorg.objectweb.jac.aspects.persistence.ValueConverter

public class ValueConverter
extends Object

General converter from and to String for all Objects.

It converts Objects into Strings to store them for persistence, and converts stored Strings into their original form for new use. OIDs are converted to @


Constructor Summary
ValueConverter()
           
 
Method Summary
static String objectToString(Storage currentStorage, Object obj)
          Returns a string representation of a value so that it can be stored.
static Object stringToObject(Storage currentStorage, String str)
          Returns an object from a string, depending on the needed type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueConverter

public ValueConverter()
Method Detail

objectToString

public static String objectToString(Storage currentStorage,
                                    Object obj)
Returns a string representation of a value so that it can be stored.

Parameters:
currentStorage - the current storage. OID values from this storage will be converted to a string which does not contain the storage id.
obj - a persistent or primitive object
Returns:
a ready to store string representation
See Also:
stringToObject(Storage,String)

stringToObject

public static Object stringToObject(Storage currentStorage,
                                    String str)
Returns an object from a string, depending on the needed type.

Parameters:
currentStorage - the current storage. OID values with no storage id will be attributed to this storage.
str - the type and value in a string format (type:value)
Returns:
an object value deduced from the string representation and from the needed type
See Also:
objectToString(Storage,Object)