org.sr.common.transformer
Class ObjectReferenceMap

java.lang.Object
  extended by org.sr.common.transformer.ObjectReferenceMap

public class ObjectReferenceMap
extends java.lang.Object

This class keeps object references within it. It's designed as a helper class to detect circular object references for java serialization/transformation purposes

Author:
Serhat Dirik

Constructor Summary
ObjectReferenceMap()
           
 
Method Summary
 void clear()
          Clears the reference map
 boolean contains(java.lang.Object obj)
          Checks if the object reference already exist in the map
 boolean contains(java.lang.Object obj, int refId)
          Checks if the object reference already exist in the map with the given referenceId
 void putObject(java.lang.Object obj)
          Puts an object reference to the map.It never thrown an exception for the null references.It simply skips them.
 void removeObject(java.lang.Object obj)
          Removes an object reference from the map.It never thrown an exception for the null references.It simply skips them.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectReferenceMap

public ObjectReferenceMap()
Method Detail

putObject

public void putObject(java.lang.Object obj)
               throws ObjectExistException
Puts an object reference to the map.It never thrown an exception for the null references.It simply skips them. This method uses object.hashCode() method for identity detection

Parameters:
obj -
Throws:
ObjectExistException - thrown if object already exist in the map

removeObject

public void removeObject(java.lang.Object obj)
Removes an object reference from the map.It never thrown an exception for the null references.It simply skips them. This method uses object.hashCode() method for identity detection

Parameters:
obj -

contains

public boolean contains(java.lang.Object obj)
Checks if the object reference already exist in the map

Parameters:
obj -
Returns:
true if exist

contains

public boolean contains(java.lang.Object obj,
                        int refId)
Checks if the object reference already exist in the map with the given referenceId

Parameters:
obj -
Returns:
true if exist

clear

public void clear()
Clears the reference map