001: /*
002: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
003: */
004: package com.tc.object.bytecode;
005:
006: import com.tc.exception.ImplementMe;
007: import com.tc.object.ObjectID;
008: import com.tc.object.TCClass;
009: import com.tc.object.TCObject;
010: import com.tc.object.dna.api.DNA;
011: import com.tc.object.dna.api.DNAException;
012: import com.tc.object.dna.api.DNAWriter;
013:
014: import gnu.trove.TLinkable;
015:
016: /**
017: * Null impl of TCObject
018: */
019: public class NullTCObject implements TCObject {
020:
021: public final static TCObject INSTANCE = new NullTCObject();
022:
023: private final static ObjectID NULL_ID = ObjectID.NULL_ID;
024:
025: // Used by bytecode stuff so won't show up in compiler
026: public static TCObject getNullTCObject() {
027: return INSTANCE;
028: }
029:
030: public void setNext(TLinkable link) {
031: // do nothing
032: }
033:
034: public void setPrevious(TLinkable link) {
035: // do nothing);
036:
037: }
038:
039: public TLinkable getNext() {
040: // do nothing
041: return null;
042: }
043:
044: public TLinkable getPrevious() {
045: // do nothing
046: return null;
047: }
048:
049: public ObjectID getObjectID() {
050: return NULL_ID;
051: }
052:
053: public Object getPeerObject() {
054: // do nothing
055: return null;
056: }
057:
058: public TCClass getTCClass() {
059: // do nothing
060: return null;
061: }
062:
063: public int clearReferences(int toClear) {
064: return 0;
065: }
066:
067: public Object getResolveLock() {
068: return this ;
069: }
070:
071: public void objectFieldChanged(String classname, String fieldname,
072: Object newValue, int index) {
073: // do nothing
074: }
075:
076: public void booleanFieldChanged(String classname, String fieldname,
077: boolean newValue, int index) {
078: // do nothing
079: }
080:
081: public void byteFieldChanged(String classname, String fieldname,
082: byte newValue, int index) {
083: // do nothing
084:
085: }
086:
087: public void charFieldChanged(String classname, String fieldname,
088: char newValue, int index) {
089: // do nothing
090: }
091:
092: public void doubleFieldChanged(String classname, String fieldname,
093: double newValue, int index) {
094: // do nothing
095: }
096:
097: public void floatFieldChanged(String classname, String fieldname,
098: float newValue, int index) {
099: // do nothing
100: }
101:
102: public void intFieldChanged(String classname, String fieldname,
103: int newValue, int index) {
104: // do nothing
105: }
106:
107: public void longFieldChanged(String classname, String fieldname,
108: long newValue, int index) {
109: // do nothing
110: }
111:
112: public void shortFieldChanged(String classname, String fieldname,
113: short newValue, int index) {
114: // do nothing
115: }
116:
117: public void logicalInvoke(int method, String methodName,
118: Object[] parameters) {
119: // do nothing
120: }
121:
122: public void hydrate(DNA from, boolean force) throws DNAException {
123: // do nothing
124: }
125:
126: public void resolveReference(String fieldName) {
127: // do nothing
128: }
129:
130: public void resolveArrayReference(int index) {
131: // do nothing
132: return;
133: }
134:
135: public ObjectID setReference(String fieldName, ObjectID id) {
136: return null;
137: }
138:
139: public void setValue(String fieldName, Object obj) {
140: // do nothing
141: }
142:
143: public long getVersion() {
144: // do nothing
145: return 0;
146: }
147:
148: public void setVersion(long version) {
149: // do nothing
150: }
151:
152: public boolean dehydrateIfNew(DNAWriter to) {
153: return true;
154: }
155:
156: public void markAccessed() {
157: //
158: }
159:
160: public void clearAccessed() {
161: //
162: }
163:
164: public boolean recentlyAccessed() {
165: return false;
166: }
167:
168: public void clearReference(String fieldName) {
169: //
170: }
171:
172: public void resolveAllReferences() {
173: // throw new ImplementMe();
174: // do nothing
175: }
176:
177: public void setIsNew() {
178: throw new AssertionError();
179: }
180:
181: public boolean isNew() {
182: throw new AssertionError();
183: }
184:
185: public boolean isShared() {
186: return true;
187: }
188:
189: public void objectFieldChangedByOffset(String classname,
190: long fieldOffset, Object newValue, int index) {
191: // do nothing
192: }
193:
194: public void logicalInvoke(Object object, String methodSignature,
195: Object[] params) {
196: throw new ImplementMe();
197: }
198:
199: public void disableAutoLocking() {
200: throw new ImplementMe();
201: }
202:
203: public boolean autoLockingDisabled() {
204: return false;
205: }
206:
207: public String getFieldNameByOffset(long fieldOffset) {
208: throw new ImplementMe();
209: }
210:
211: public boolean canEvict() {
212: throw new ImplementMe();
213: }
214:
215: public void objectArrayChanged(int startPos, Object[] array,
216: int length) {
217: // do nothing
218: }
219:
220: public void primitiveArrayChanged(int startPos, Object array,
221: int length) {
222: // do nothing
223: }
224:
225: public int accessCount(int factor) {
226: throw new ImplementMe();
227: }
228:
229: public void literalValueChanged(Object newValue, Object oldValue) {
230: // do nothing
231: }
232:
233: public void setLiteralValue(Object newValue) {
234: // do nothing
235: }
236:
237: public ArrayIndexOutOfBoundsException checkArrayIndex(int index) {
238: return null;
239: }
240:
241: public void setArrayReference(int index, ObjectID id) {
242: //
243: }
244:
245: public boolean isFieldPortableByOffset(long fieldOffset) {
246: throw new ImplementMe();
247: }
248:
249: }
|