KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > bytecode > NullTCObject


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.object.bytecode;
5
6 import com.tc.exception.ImplementMe;
7 import com.tc.object.ObjectID;
8 import com.tc.object.TCClass;
9 import com.tc.object.TCObject;
10 import com.tc.object.dna.api.DNA;
11 import com.tc.object.dna.api.DNAException;
12 import com.tc.object.dna.api.DNAWriter;
13
14 import gnu.trove.TLinkable;
15
16 /**
17  * Null impl of TCObject
18  */

19 public class NullTCObject implements TCObject {
20
21   public final static TCObject INSTANCE = new NullTCObject();
22
23   private final static ObjectID NULL_ID = ObjectID.NULL_ID;
24
25   // Used by bytecode stuff so won't show up in compiler
26
public static TCObject getNullTCObject() {
27     return INSTANCE;
28   }
29
30   public void setNext(TLinkable link) {
31     // do nothing
32
}
33
34   public void setPrevious(TLinkable link) {
35     // do nothing);
36

37   }
38
39   public TLinkable getNext() {
40     // do nothing
41
return null;
42   }
43
44   public TLinkable getPrevious() {
45     // do nothing
46
return null;
47   }
48
49   public ObjectID getObjectID() {
50     return NULL_ID;
51   }
52
53   public Object JavaDoc getPeerObject() {
54     // do nothing
55
return null;
56   }
57
58   public TCClass getTCClass() {
59     // do nothing
60
return null;
61   }
62
63   public int clearReferences(int toClear) {
64     return 0;
65   }
66
67   public Object JavaDoc getResolveLock() {
68     return this;
69   }
70
71   public void objectFieldChanged(String JavaDoc classname, String JavaDoc fieldname, Object JavaDoc newValue, int index) {
72     // do nothing
73
}
74
75   public void booleanFieldChanged(String JavaDoc classname, String JavaDoc fieldname, boolean newValue, int index) {
76     // do nothing
77
}
78
79   public void byteFieldChanged(String JavaDoc classname, String JavaDoc fieldname, byte newValue, int index) {
80     // do nothing
81

82   }
83
84   public void charFieldChanged(String JavaDoc classname, String JavaDoc fieldname, char newValue, int index) {
85     // do nothing
86
}
87
88   public void doubleFieldChanged(String JavaDoc classname, String JavaDoc fieldname, double newValue, int index) {
89     // do nothing
90
}
91
92   public void floatFieldChanged(String JavaDoc classname, String JavaDoc fieldname, float newValue, int index) {
93     // do nothing
94
}
95
96   public void intFieldChanged(String JavaDoc classname, String JavaDoc fieldname, int newValue, int index) {
97     // do nothing
98
}
99
100   public void longFieldChanged(String JavaDoc classname, String JavaDoc fieldname, long newValue, int index) {
101     // do nothing
102
}
103
104   public void shortFieldChanged(String JavaDoc classname, String JavaDoc fieldname, short newValue, int index) {
105     // do nothing
106
}
107
108   public void logicalInvoke(int method, String JavaDoc methodName, Object JavaDoc[] parameters) {
109     // do nothing
110
}
111
112   public void hydrate(DNA from, boolean force) throws DNAException {
113     // do nothing
114
}
115
116   public void resolveReference(String JavaDoc fieldName) {
117     // do nothing
118
}
119
120   public void resolveArrayReference(int index) {
121     // do nothing
122
return;
123   }
124
125   public void setReference(String JavaDoc fieldName, ObjectID id) {
126     // do nothing
127
}
128
129   public void setValue(String JavaDoc fieldName, Object JavaDoc obj) {
130     // do nothing
131
}
132
133   public long getVersion() {
134     // do nothing
135
return 0;
136   }
137
138   public void setVersion(long version) {
139     // do nothing
140
}
141
142   public void dehydrate(DNAWriter to) throws DNAException {
143     // do nothing
144
}
145
146   public void markAccessed() {
147     //
148
}
149
150   public void clearAccessed() {
151     //
152
}
153
154   public boolean recentlyAccessed() {
155     return false;
156   }
157
158   public void clearReference(String JavaDoc fieldName) {
159     //
160
}
161
162   public void resolveAllReferences() {
163     // throw new ImplementMe();
164
// do nothing
165
}
166
167   public boolean getAndResetNew() {
168     throw new AssertionError JavaDoc();
169   }
170
171   public void setIsNew() {
172     throw new AssertionError JavaDoc();
173   }
174
175   public boolean isNew() {
176     throw new AssertionError JavaDoc();
177   }
178
179   public boolean isShared() {
180     return true;
181   }
182   public void objectFieldChangedByOffset(String JavaDoc classname, long fieldOffset, Object JavaDoc newValue, int index) {
183     // do nothing
184
}
185
186   public void logicalInvoke(Object JavaDoc object, String JavaDoc methodSignature, Object JavaDoc[] params) {
187     throw new ImplementMe();
188   }
189
190   public void disableAutoLocking() {
191     throw new ImplementMe();
192   }
193
194   public boolean autoLockingDisabled() {
195     return false;
196   }
197
198   public String JavaDoc getFieldNameByOffset(long fieldOffset) {
199     throw new ImplementMe();
200   }
201
202   public boolean canEvict() {
203     throw new ImplementMe();
204   }
205
206   public void objectArrayChanged(int startPos, Object JavaDoc[] array, int length) {
207     // do nothing
208
}
209
210   public void primitiveArrayChanged(int startPos, Object JavaDoc array, int length) {
211     // do nothing
212
}
213
214   public int accessCount(int factor) {
215     throw new ImplementMe();
216   }
217
218   public void literalValueChanged(Object JavaDoc newValue, Object JavaDoc oldValue) {
219     // do nothing
220
}
221
222   public void setLiteralValue(Object JavaDoc newValue) {
223     // do nothing
224
}
225
226   public ArrayIndexOutOfBoundsException JavaDoc checkArrayIndex(int index) {
227     return null;
228   }
229
230 }
231
Popular Tags