com.miginfocom.util.io
Class ObjectConverter

java.lang.Object
  extended by com.miginfocom.util.io.ObjectConverter

public abstract class ObjectConverter
extends java.lang.Object

A converter that can convert from one object representation to another.

This is usually for converting to and from an object that can be stored.


Constructor Summary
protected ObjectConverter(java.lang.Class objectClass, java.lang.Class storageClass)
          Constructor.
 
Method Summary
abstract  java.lang.Object convertFromObjectToStorage(java.lang.Object o)
          Converts from an object in memory to an object slated for storage.
abstract  java.lang.Object convertFromStorageToObject(java.lang.Object o)
          Converts from a storage object to an in memory object.
 java.lang.Class getObjectClass()
          Returns the class that will be created by convertFromStorageToObject(Object)
 java.lang.Class getStorageClass()
          Returns the class that will be created by convertFromObjectToStorage(Object)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectConverter

protected ObjectConverter(java.lang.Class objectClass,
                          java.lang.Class storageClass)
Constructor.

Parameters:
objectClass - The class that will be returned by getObjectClass()
storageClass - The class that will be returned by getStorageClass()
Method Detail

getStorageClass

public java.lang.Class getStorageClass()
Returns the class that will be created by convertFromObjectToStorage(Object)

Returns:
The class. Never null. Might be a base class of the actual class returned.

getObjectClass

public java.lang.Class getObjectClass()
Returns the class that will be created by convertFromStorageToObject(Object)

Returns:
The class. Never null. Might be a base class of the actual class returned.

convertFromObjectToStorage

public abstract java.lang.Object convertFromObjectToStorage(java.lang.Object o)
Converts from an object in memory to an object slated for storage. Should throw an appropriate runtime exception if convertion could not be conducted.

Parameters:
o - The object to convert. May be null.
Returns:
o converted. Might be null.

convertFromStorageToObject

public abstract java.lang.Object convertFromStorageToObject(java.lang.Object o)
Converts from a storage object to an in memory object. Should throw an appropriate runtime exception if convertion could not be conducted.

Parameters:
o - The object to convert. May be null.
Returns:
o converted. Might be null.


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.