KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > runtime > gcbasictypeelem > GcRefAccessor


1 /**
2  * JORM: an implementation of a generic mapping system for persistent Java
3  * objects. Two mapping are supported: to RDBMS and to binary files.
4  * Copyright (C) 2001-2003 France Telecom R&D - INRIA
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Contact: jorm-team@objectweb.org
21  *
22  */

23
24 package org.objectweb.jorm.runtime.gcbasictypeelem;
25
26 import org.objectweb.jorm.api.PAccessor;
27 import org.objectweb.jorm.api.PException;
28 import org.objectweb.jorm.pobject.gcbasictypeelem.BooleanSetAccessor;
29 import org.objectweb.jorm.pobject.gcbasictypeelem.ByteSetAccessor;
30 import org.objectweb.jorm.pobject.gcbasictypeelem.CharSetAccessor;
31 import org.objectweb.jorm.pobject.gcbasictypeelem.DoubleSetAccessor;
32 import org.objectweb.jorm.pobject.gcbasictypeelem.DateSetAccessor;
33 import org.objectweb.jorm.pobject.gcbasictypeelem.FloatSetAccessor;
34 import org.objectweb.jorm.pobject.gcbasictypeelem.IntSetAccessor;
35 import org.objectweb.jorm.pobject.gcbasictypeelem.LongSetAccessor;
36 import org.objectweb.jorm.pobject.gcbasictypeelem.ObooleanSetAccessor;
37 import org.objectweb.jorm.pobject.gcbasictypeelem.ObyteSetAccessor;
38 import org.objectweb.jorm.pobject.gcbasictypeelem.OcharSetAccessor;
39 import org.objectweb.jorm.pobject.gcbasictypeelem.OdoubleSetAccessor;
40 import org.objectweb.jorm.pobject.gcbasictypeelem.OfloatSetAccessor;
41 import org.objectweb.jorm.pobject.gcbasictypeelem.OintSetAccessor;
42 import org.objectweb.jorm.pobject.gcbasictypeelem.OlongSetAccessor;
43 import org.objectweb.jorm.pobject.gcbasictypeelem.OshortSetAccessor;
44 import org.objectweb.jorm.pobject.gcbasictypeelem.ShortSetAccessor;
45 import org.objectweb.jorm.pobject.gcbasictypeelem.StringSetAccessor;
46 import org.objectweb.jorm.pobject.gcbasictypeelem.SerializedSetAccessor;
47 import org.objectweb.jorm.pobject.gcbasictypeelem.BytearraySetAccessor;
48 import org.objectweb.jorm.pobject.gcbasictypeelem.ChararraySetAccessor;
49 import org.objectweb.jorm.naming.api.PName;
50 import junit.framework.Assert;
51
52 /**
53  * @author P. Dechamboux
54  */

55 public class GcRefAccessor implements
56         BooleanSetAccessor,
57         ObooleanSetAccessor,
58         ByteSetAccessor,
59         ObyteSetAccessor,
60         CharSetAccessor,
61         OcharSetAccessor,
62         ShortSetAccessor,
63         OshortSetAccessor,
64         IntSetAccessor,
65         OintSetAccessor,
66         LongSetAccessor,
67         OlongSetAccessor,
68         FloatSetAccessor,
69         OfloatSetAccessor,
70         DoubleSetAccessor,
71         OdoubleSetAccessor,
72         StringSetAccessor,
73         DateSetAccessor,
74         SerializedSetAccessor,
75         BytearraySetAccessor,
76         ChararraySetAccessor,
77         PAccessor {
78     private PName gcRef;
79
80     public GcRefAccessor(PName gcRef) {
81         this.gcRef = gcRef;
82     }
83
84     //Accessors to the mygc field
85
public void paSetMygc(PName val, Object JavaDoc connection) throws PException {
86         gcRef = val;
87     }
88
89     public PName paGetMygc(Object JavaDoc connection) throws PException {
90         return gcRef;
91     }
92
93     public Object JavaDoc getMemoryInstance() {
94         return this;
95     }
96
97     public boolean equals(Object JavaDoc obj) {
98         Assert.assertTrue("Wrong object class: should be a GcRefAccessor", obj instanceof GcRefAccessor);
99         Assert.assertEquals("Wrong refernce", gcRef, ((GcRefAccessor) obj).gcRef);
100         return true;
101     }
102 }
103
Popular Tags