org.apache.ojb.otm.swizzle
Interface Swizzling

All Known Implementing Classes:
CopySwizzling, NoSwizzling

public interface Swizzling

Swizzles object references as objects are displaced by other similar objects in the EditingContext.

Author:
Raghu Rajah

Method Summary
 java.lang.Object getRealTarget(java.lang.Object swizzledObject)
          Get the real object associated with the given swizzled object.
 boolean isSameInstance(java.lang.Object swizzledObject, java.lang.Object object)
          Test if the given swizzled object is the same as the given object.
 java.lang.Object swizzle(java.lang.Object newObj, java.lang.Object oldObj, PersistenceBroker pb, ObjectCache cache)
          Swizzle object references.
 

Method Detail

swizzle

public java.lang.Object swizzle(java.lang.Object newObj,
                                java.lang.Object oldObj,
                                PersistenceBroker pb,
                                ObjectCache cache)
Swizzle object references.

Parameters:
newObj - the object being inserted into the EditingContext, is null if the object is being invalidated
oldObj - the object present in the EditingContext, is null if no object is present
pb - the PersistenceBroker that is used to get persistent class info
cache - the "cache" of old objects, only lookup() method can be used by the Swizzling implementation to seek for old objects that should be set as a new value of relations
Returns:
the Swizzled Object

isSameInstance

public boolean isSameInstance(java.lang.Object swizzledObject,
                              java.lang.Object object)
Test if the given swizzled object is the same as the given object. By same object we mean, that the System.identityHashCode() of the given object is the same as that of the object represented by the swizzled object.

Parameters:
swizzledObject - The swizzled object
object - The other object to be compared to
Returns:
true, if they are the same. false, otherwise.

getRealTarget

public java.lang.Object getRealTarget(java.lang.Object swizzledObject)
Get the real object associated with the given swizzled object.

Parameters:
swizzledObject - the swizzled object
Returns:
the real object


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14