KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > runtime > namedef > NameDefAccessor


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.namedef;
25
26 import org.objectweb.jorm.api.PAccessor;
27 import org.objectweb.jorm.api.PException;
28
29 import org.objectweb.jorm.pobject.singlename.ASingleByteIdAccessor;
30 import org.objectweb.jorm.pobject.singlename.ASingleCharIdAccessor;
31 import org.objectweb.jorm.pobject.singlename.ASingleShortIdAccessor;
32 import org.objectweb.jorm.pobject.singlename.ASingleIntIdAccessor;
33 import org.objectweb.jorm.pobject.singlename.ASingleLongIdAccessor;
34 import org.objectweb.jorm.pobject.singlename.ASingleObyteIdAccessor;
35 import org.objectweb.jorm.pobject.singlename.ASingleOcharIdAccessor;
36 import org.objectweb.jorm.pobject.singlename.ASingleOshortIdAccessor;
37 import org.objectweb.jorm.pobject.singlename.ASingleOintIdAccessor;
38 import org.objectweb.jorm.pobject.singlename.ASingleOlongIdAccessor;
39 import org.objectweb.jorm.pobject.singlename.ASingleStringIdAccessor;
40 import org.objectweb.jorm.pobject.singlename.ASingleDateIdAccessor;
41 import org.objectweb.jorm.pobject.singlename.ASingleBytearrayIdAccessor;
42 import org.objectweb.jorm.pobject.singlename.ASingleChararrayIdAccessor;
43 import org.objectweb.jorm.pobject.singlename.ASingleBigDecimalIdAccessor;
44 import org.objectweb.jorm.pobject.singlename.ASingleBigIntegerIdAccessor;
45 import org.objectweb.jorm.pobject.compositename.ACompositeByteIdAccessor;
46 import org.objectweb.jorm.pobject.compositename.ACompositeCharIdAccessor;
47 import org.objectweb.jorm.pobject.compositename.ACompositeShortIdAccessor;
48 import org.objectweb.jorm.pobject.compositename.ACompositeIntIdAccessor;
49 import org.objectweb.jorm.pobject.compositename.ACompositeLongIdAccessor;
50 import org.objectweb.jorm.pobject.compositename.ACompositeObyteIdAccessor;
51 import org.objectweb.jorm.pobject.compositename.ACompositeOcharIdAccessor;
52 import org.objectweb.jorm.pobject.compositename.ACompositeOshortIdAccessor;
53 import org.objectweb.jorm.pobject.compositename.ACompositeOintIdAccessor;
54 import org.objectweb.jorm.pobject.compositename.ACompositeOlongIdAccessor;
55 import org.objectweb.jorm.pobject.compositename.ACompositeStringIdAccessor;
56 import org.objectweb.jorm.pobject.compositename.ACompositeDateIdAccessor;
57 import org.objectweb.jorm.pobject.compositename.ACompositeBigDecimalIdAccessor;
58 import org.objectweb.jorm.pobject.compositename.ACompositeBigIntegerIdAccessor;
59 import org.objectweb.jorm.pobject.compositename.ACompositeBytearrayIdAccessor;
60 import org.objectweb.jorm.pobject.compositename.ACompositeChararrayIdAccessor;
61 import org.objectweb.jorm.naming.api.PName;
62
63 import java.util.Date JavaDoc;
64 import java.math.BigInteger JavaDoc;
65 import java.math.BigDecimal JavaDoc;
66
67 /**
68  *
69  * @author S.Chassande-Barrioz
70  */

71 public class NameDefAccessor
72         implements
73         ASingleByteIdAccessor,
74         ASingleCharIdAccessor,
75         ASingleShortIdAccessor,
76         ASingleIntIdAccessor,
77         ASingleLongIdAccessor,
78         ASingleObyteIdAccessor,
79         ASingleOcharIdAccessor,
80         ASingleOshortIdAccessor,
81         ASingleOintIdAccessor,
82         ASingleOlongIdAccessor,
83         ASingleStringIdAccessor,
84         ASingleDateIdAccessor,
85         ASingleBigDecimalIdAccessor,
86         ASingleBigIntegerIdAccessor,
87         ASingleBytearrayIdAccessor,
88         ASingleChararrayIdAccessor,
89         ACompositeByteIdAccessor,
90         ACompositeCharIdAccessor,
91         ACompositeShortIdAccessor,
92         ACompositeIntIdAccessor,
93         ACompositeLongIdAccessor,
94         ACompositeObyteIdAccessor,
95         ACompositeOcharIdAccessor,
96         ACompositeOshortIdAccessor,
97         ACompositeOintIdAccessor,
98         ACompositeOlongIdAccessor,
99         ACompositeStringIdAccessor,
100         ACompositeDateIdAccessor,
101         ACompositeBigDecimalIdAccessor,
102         ACompositeBigIntegerIdAccessor,
103         ACompositeBytearrayIdAccessor,
104         ACompositeChararrayIdAccessor,
105         PAccessor {
106
107     public int f1;
108     public Object JavaDoc value;
109     public PName myself1 = null;
110     public PName myself2 = null;
111
112     public NameDefAccessor() {
113     }
114
115     public NameDefAccessor(int f1) {
116         this.f1 = f1;
117     }
118
119     public NameDefAccessor(int f1, PName myself1, PName myself2) {
120         this.f1 = f1;
121         this.myself1 = myself1;
122         this.myself2 = myself2;
123     }
124
125     public NameDefAccessor(int f1, Object JavaDoc value) {
126         this.f1 = f1;
127         this.value = value;
128     }
129
130     public NameDefAccessor(int f1, Object JavaDoc value, PName myself1, PName myself2) {
131         this.f1 = f1;
132         this.value = value;
133         this.myself1 = myself1;
134         this.myself2 = myself2;
135     }
136
137     public void paSetF1(int val) throws PException {
138         f1 = val;
139     }
140
141     public int paGetF1() throws PException {
142         return f1;
143     }
144
145     //Accessors to the myself field
146
public void paSetMyself1(PName val, Object JavaDoc connection) throws PException {
147         myself1 = val;
148     }
149
150     public PName paGetMyself1(Object JavaDoc connection) throws PException {
151         return myself1;
152     }
153
154     //Accessors to the myself field
155
public void paSetMyself2(PName val, Object JavaDoc connection) throws PException {
156         myself2 = val;
157     }
158
159     public PName paGetMyself2(Object JavaDoc connection) throws PException {
160         return myself2;
161     }
162
163     // IMPEMENTATION OF THE PAccessor INTERFACE //
164
//------------------------------------------//
165

166     public Object JavaDoc getMemoryInstance() {
167         return null;
168     }
169
170     // IMPLEMENTATION OF THE ACompositeByteIdAccessor INTERFACE //
171
//----------------------------------------------------------//
172

173     public void paSetNameByte(byte val) throws PException {
174         value = new Byte JavaDoc(val);
175     }
176
177     public byte paGetNameByte() throws PException {
178         return ((Byte JavaDoc) value).byteValue();
179     }
180
181     // IMPLEMENTATION OF THE ACompositeCharIdAccessor INTERFACE //
182
//----------------------------------------------------------//
183

184     public void paSetNameChar(char val) throws PException {
185         value = new Character JavaDoc(val);
186     }
187
188     public char paGetNameChar() throws PException {
189         return ((Character JavaDoc) value).charValue();
190     }
191
192     // IMPLEMENTATION OF THE ACompositeShortIdAccessor INTERFACE //
193
//-----------------------------------------------------------//
194

195     public void paSetNameShort(short val) throws PException {
196         value = new Short JavaDoc(val);
197     }
198
199     public short paGetNameShort() throws PException {
200         return ((Short JavaDoc) value).shortValue();
201     }
202
203     // IMPLEMENTATION OF THE ACompositeIntIdAccessor INTERFACE //
204
//-----------------------------------------------------------//
205

206     public void paSetNameInt(int val) throws PException {
207         value = new Integer JavaDoc(val);
208     }
209
210     public int paGetNameInt() throws PException {
211         return ((Integer JavaDoc) value).intValue();
212     }
213
214     // IMPLEMENTATION OF THE ACompositeIntIdAccessor INTERFACE //
215
//-----------------------------------------------------------//
216

217     public void paSetNameLong(long val) throws PException {
218         value = new Long JavaDoc(val);
219     }
220
221     public long paGetNameLong() throws PException {
222         return ((Long JavaDoc) value).longValue();
223     }
224
225     // IMPLEMENTATION OF THE ACompositeObyteIdAccessor INTERFACE //
226
//-----------------------------------------------------------//
227

228     public void paSetNameObyte(Byte JavaDoc val) throws PException {
229         value = val;
230     }
231
232     public Byte JavaDoc paGetNameObyte() throws PException {
233         return (Byte JavaDoc) value;
234     }
235
236     // IMPLEMENTATION OF THE ACompositeOcharIdAccessor INTERFACE //
237
//-----------------------------------------------------------//
238

239     public void paSetNameOchar(Character JavaDoc val) throws PException {
240         value = val;
241     }
242
243     public Character JavaDoc paGetNameOchar() throws PException {
244         return (Character JavaDoc) value;
245     }
246
247     // IMPLEMENTATION OF THE ACompositeOshortIdAccessor INTERFACE //
248
//------------------------------------------------------------//
249

250     public void paSetNameOshort(Short JavaDoc val) throws PException {
251         value = val;
252     }
253
254     public Short JavaDoc paGetNameOshort() throws PException {
255         return (Short JavaDoc) value;
256     }
257
258     // IMPLEMENTATION OF THE ACompositeOintIdAccessor INTERFACE //
259
//----------------------------------------------------------//
260

261     public void paSetNameOint(Integer JavaDoc val) throws PException {
262         value = val;
263     }
264
265     public Integer JavaDoc paGetNameOint() throws PException {
266         return (Integer JavaDoc) value;
267     }
268
269     // IMPLEMENTATION OF THE ACompositeOlongIdAccessor INTERFACE //
270
//-----------------------------------------------------------//
271

272     public void paSetNameOlong(Long JavaDoc val) throws PException {
273         value = val;
274     }
275
276     public Long JavaDoc paGetNameOlong() throws PException {
277         return (Long JavaDoc) value;
278     }
279
280     // IMPLEMENTATION OF THE ACompositeStringIdAccessor INTERFACE //
281
//-----------------------------------------------------------//
282

283     public void paSetNameString(String JavaDoc val) throws PException {
284         value = val;
285     }
286
287     public String JavaDoc paGetNameString() throws PException {
288         return (String JavaDoc) value;
289     }
290
291     // IMPLEMENTATION OF THE ACompositeDateIdAccessor INTERFACE //
292
//-----------------------------------------------------------//
293

294     public void paSetNameDate(Date JavaDoc val) throws PException {
295         value = val;
296     }
297
298     public Date JavaDoc paGetNameDate() throws PException {
299         return (Date JavaDoc) value;
300     }
301
302     // IMPLEMENTATION OF THE ACompositeBigDecimalIdAccessor INTERFACE //
303
//-----------------------------------------------------------//
304

305     public void paSetNameBigDecimal(BigDecimal JavaDoc val) throws PException {
306         value = val;
307     }
308
309     public BigDecimal JavaDoc paGetNameBigDecimal() throws PException {
310         return (BigDecimal JavaDoc) value;
311     }
312
313     // IMPLEMENTATION OF THE ACompositeBigIntegerIdAccessor INTERFACE //
314
//-----------------------------------------------------------//
315

316     public void paSetNameBigInteger(BigInteger JavaDoc val) throws PException {
317         value = val;
318     }
319
320     public BigInteger JavaDoc paGetNameBigInteger() throws PException {
321         return (BigInteger JavaDoc) value;
322     }
323
324     // IMPLEMENTATION OF THE ACompositeBytearrayIdAccessor INTERFACE //
325
//-----------------------------------------------------------//
326

327     public void paSetNameBytearray(byte[] val) throws PException {
328         value = val;
329     }
330
331     public byte[] paGetNameBytearray() throws PException {
332         return (byte[]) value;
333     }
334
335     // IMPLEMENTATION OF THE ACompositeChararrayIdAccessor INTERFACE //
336
//-----------------------------------------------------------//
337

338     public void paSetNameChararray(char[] val) throws PException {
339         value = val;
340     }
341
342     public char[] paGetNameChararray() throws PException {
343         return (char[]) value;
344     }
345 }
346
Popular Tags