1 21 package com.db4o; 22 23 import com.db4o.inside.marshall.*; 24 import com.db4o.reflect.*; 25 26 27 30 final class YapClassAny extends YapClass { 31 32 public YapClassAny(YapStream stream){ 33 super(stream, stream.i_handlers.ICLASS_OBJECT); 34 } 35 36 public boolean canHold(ReflectClass claxx) { 37 return true; 38 } 39 40 public void cascadeActivation( 41 Transaction a_trans, 42 Object a_object, 43 int a_depth, 44 boolean a_activate) { 45 YapClass yc = forObject(a_trans, a_object, false); 46 if (yc != null) { 47 yc.cascadeActivation(a_trans, a_object, a_depth, a_activate); 48 } 49 } 50 51 public void deleteEmbedded(MarshallerFamily mf, YapWriter reader) { 52 mf._untyped.deleteEmbedded(reader); 53 } 54 55 public int getID() { 56 return 11; 57 } 58 59 public boolean hasField(YapStream a_stream, String a_path) { 60 return a_stream.classCollection().fieldExists(a_path); 61 } 62 63 public boolean hasIndex() { 64 return false; 65 } 66 67 public boolean hasFixedLength(){ 68 return false; 69 } 70 71 public boolean holdsAnyClass() { 72 return true; 73 } 74 75 public int isSecondClass(){ 76 return YapConst.UNKNOWN; 77 } 78 79 boolean isStrongTyped(){ 80 return false; 81 } 82 83 public void calculateLengths(Transaction trans, ObjectHeaderAttributes header, boolean topLevel, Object obj, boolean withIndirection) { 84 if(topLevel){ 85 header.addBaseLength(YapConst.INT_LENGTH); 86 }else{ 87 header.addPayLoadLength(YapConst.INT_LENGTH); } 89 YapClass yc = forObject(trans, obj, true); 90 if( yc == null){ 91 return; 92 } 93 header.addPayLoadLength(YapConst.INT_LENGTH); yc.calculateLengths(trans, header, false, obj, false); 95 } 96 97 public Object read(MarshallerFamily mf, YapWriter a_bytes, boolean redirect) throws CorruptionException{ 98 if(mf._untyped.useNormalClassRead()){ 99 return super.read(mf, a_bytes, redirect); 100 } 101 return mf._untyped.read(a_bytes); 102 } 103 104 public TypeHandler4 readArrayHandler(Transaction a_trans, MarshallerFamily mf, YapReader[] a_bytes) { 105 return mf._untyped.readArrayHandler(a_trans, a_bytes); 106 } 107 108 public Object readQuery(Transaction trans, MarshallerFamily mf, boolean withRedirection, YapReader reader, boolean toArray) throws CorruptionException{ 109 if(mf._untyped.useNormalClassRead()){ 110 return super.readQuery(trans, mf, withRedirection, reader, toArray); 111 } 112 return mf._untyped.readQuery(trans, reader, toArray); 113 } 114 115 public QCandidate readSubCandidate(MarshallerFamily mf, YapReader reader, QCandidates candidates, boolean withIndirection) { 116 if(mf._untyped.useNormalClassRead()){ 117 return super.readSubCandidate(mf, reader, candidates, withIndirection); 118 } 119 return mf._untyped.readSubCandidate(reader, candidates, withIndirection); 120 } 121 122 public boolean supportsIndex() { 123 return false; 124 } 125 126 public Object writeNew(MarshallerFamily mf, Object obj, boolean topLevel, YapWriter writer, boolean withIndirection, boolean restoreLinkeOffset) { 127 return mf._untyped.writeNew(obj, restoreLinkeOffset, writer); 128 } 129 130 public void defrag(MarshallerFamily mf, ReaderPair readers, boolean redirect) { 131 if(mf._untyped.useNormalClassRead()){ 132 super.defrag(mf,readers, redirect); 133 } 134 mf._untyped.defrag(readers); 135 } 136 } 137 | Popular Tags |