KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > otm > swizzle > Swizzling


1 package org.apache.ojb.otm.swizzle;
2
3 /* Copyright 2003-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18
19 import org.apache.ojb.broker.PersistenceBroker;
20 import org.apache.ojb.broker.cache.ObjectCache;
21
22 /**
23  * @todo document
24  */

25 public interface Swizzling
26 {
27
28     /**
29      *
30      * Swizzle object references.
31      *
32      * @param newObj the object being inserted into the EditingContext,
33      * is null if the object is being invalidated
34      * @param oldObj the object present in the EditingContext,
35      * is null if no object is present
36      * @param pb the PersistenceBroker that is used to get
37      * persistent class info
38      * @param cache the "cache" of old objects, only lookup() method
39      * can be used by the Swizzling implementation to seek for old objects
40      * that should be set as a new value of relations.
41      *
42      * @return the Swizzled Object
43      *
44      */

45     public Object JavaDoc swizzle(Object JavaDoc newObj, Object JavaDoc oldObj, PersistenceBroker pb,
46                           ObjectCache cache);
47
48     /**
49      *
50      * Test if the given swizzled object is the same as the given object. By same object we mean,
51      * that the System.identityHashCode() of the given object is the same as that of the object
52      * represented by the swizzled object.
53      *
54      * @param swizzledObject The swizzled object
55      * @param object The other object to be compared to
56      * @return true, if they are the same. false, otherwise.
57      *
58      */

59     public boolean isSameInstance(Object JavaDoc swizzledObject, Object JavaDoc object);
60
61     /**
62      *
63      * Get the real object associated with the given swizzled object.
64      *
65      * @param swizzledObject the swizzled object
66      * @return the real object
67      *
68      */

69     public Object JavaDoc getRealTarget(Object JavaDoc swizzledObject);
70 }
71
Popular Tags