KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > TypeHandler4


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10 Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11 Suite 350, San Mateo, CA 94403, USA.
12
13 db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

21 package com.db4o;
22
23 import com.db4o.inside.ix.*;
24 import com.db4o.inside.marshall.*;
25 import com.db4o.reflect.*;
26
27 /**
28  * @exclude
29  */

30 public interface TypeHandler4 extends Indexable4
31 {
32     
33     boolean canHold(ReflectClass claxx);
34     
35     void cascadeActivation(Transaction a_trans, Object JavaDoc a_object, int a_depth, boolean a_activate);
36     
37     ReflectClass classReflector();
38     
39     Object JavaDoc coerce(ReflectClass claxx, Object JavaDoc obj);
40     
41     // special construct for deriving from simple types
42
void copyValue(Object JavaDoc a_from, Object JavaDoc a_to);
43     
44     void deleteEmbedded(MarshallerFamily mf, YapWriter a_bytes);
45     
46     int getID();
47     
48     boolean equals(TypeHandler4 a_dataType); // needed for YapField.equals
49

50     boolean hasFixedLength();
51     
52     boolean indexNullHandling();
53     
54     int isSecondClass();
55     
56     /**
57      * The length calculation is different, depending from where we
58      * calculate. If we are still in the link area at the beginning of
59      * the slot, no data needs to be written to the payload area for
60      * primitive types, since they fully fit into the link area. If
61      * we are already writing something like an array (or deeper) to
62      * the payload area when we come here, a primitive does require
63      * space in the payload area.
64      * Differentiation is expressed with the 'topLevel' parameter.
65      * If 'topLevel==true' we are asking for a size calculation for
66      * the link area. If 'topLevel==false' we are asking for a size
67      * calculation for the payload area at the end of the slot.
68      */

69     void calculateLengths(Transaction trans, ObjectHeaderAttributes header, boolean topLevel, Object JavaDoc obj, boolean withIndirection);
70     
71     Object JavaDoc indexEntryToObject(Transaction trans, Object JavaDoc indexEntry);
72     
73     void prepareComparison(Transaction a_trans, Object JavaDoc obj);
74     
75     ReflectClass primitiveClassReflector();
76     
77     Object JavaDoc read(MarshallerFamily mf, YapWriter writer, boolean redirect) throws CorruptionException;
78     
79     Object JavaDoc readIndexEntry(MarshallerFamily mf, YapWriter writer) throws CorruptionException;
80     
81     Object JavaDoc readQuery(Transaction trans, MarshallerFamily mf, boolean withRedirection, YapReader reader, boolean toArray) throws CorruptionException;
82     
83     boolean supportsIndex();
84     
85     Object JavaDoc writeNew(MarshallerFamily mf, Object JavaDoc a_object, boolean topLevel, YapWriter a_bytes, boolean withIndirection, boolean restoreLinkOffset);
86     
87     public int getTypeID ();
88     
89     YapClass getYapClass(YapStream a_stream);
90     
91     /**
92      * performance optimized read (only used for byte[] so far)
93      */

94     boolean readArray(Object JavaDoc array, YapReader reader);
95     
96     void readCandidates(MarshallerFamily mf, YapReader reader, QCandidates candidates);
97     
98     TypeHandler4 readArrayHandler(Transaction a_trans, MarshallerFamily mf, YapReader[] a_bytes);
99     
100     /**
101      * performance optimized write (only used for byte[] so far)
102      */

103     boolean writeArray(Object JavaDoc array, YapReader reader);
104
105     QCandidate readSubCandidate(MarshallerFamily mf, YapReader reader, QCandidates candidates, boolean withIndirection);
106
107     void defrag(MarshallerFamily mf, ReaderPair readers, boolean redirect);
108 }
109
Popular Tags