01: /**********************************************************************
02: Copyright (c) 2005 Andy Jefferson and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: Unless required by applicable law or agreed to in writing, software
10: distributed under the License is distributed on an "AS IS" BASIS,
11: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: See the License for the specific language governing permissions and
13: limitations under the License.
14:
15:
16: Contributors:
17: ...
18: **********************************************************************/package org.jpox.cache;
19:
20: /**
21: * An object that is stored in the Level2 Cache.
22: * Comprises a persistable object, and its loaded fields array so we know which fields are loaded when we
23: * retrieve it from the cache.
24: *
25: * @version $Revision: 1.4 $
26: */
27: public class CachedPC {
28: /** The persistable object */
29: private Object pc;
30:
31: /** The loaded fields array */
32: private boolean[] loadedFields;
33:
34: /**
35: * Constructor.
36: * @param pc The persistable object
37: * @param loadedFields The loaded fields
38: */
39: public CachedPC(Object pc, boolean[] loadedFields) {
40: this .pc = pc;
41: this .loadedFields = new boolean[loadedFields.length];
42: for (int i = 0; i < loadedFields.length; i++) {
43: this .loadedFields[i] = loadedFields[i];
44: }
45: }
46:
47: /**
48: * Accessor for the persistable object
49: * @return The PC object
50: */
51: public Object getPersistableObject() {
52: return pc;
53: }
54:
55: /**
56: * Accessor for the class of the persistable object.
57: * @return The class of the object
58: */
59: public Class getPCClass() {
60: return pc.getClass();
61: }
62:
63: /**
64: * Accessor for the loaded fields of this object
65: * @return The loaded fields
66: */
67: public boolean[] getLoadedFields() {
68: return loadedFields;
69: }
70: }
|