KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > runtime > multitable > ClassRef_MT


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.multitable;
25
26 import org.objectweb.jorm.pobject.multitable.ClassRef_SN_MTAccessor;
27 import org.objectweb.jorm.pobject.multitable.ClassRef_CN_MTAccessor;
28 import org.objectweb.jorm.naming.api.PName;
29 import org.objectweb.jorm.api.PException;
30 import junit.framework.Assert;
31
32 /**
33  * @author S. Chassandes-Barrioz
34  */

35 public class ClassRef_MT
36     implements ClassRef_SN_MTAccessor,
37     ClassRef_CN_MTAccessor {
38
39     public PName c = null;
40     public PName d = null;
41
42     public ClassRef_MT() {
43     }
44
45     public ClassRef_MT(PName c, PName d) {
46         this.c = c;
47         this.d = d;
48     }
49     public String JavaDoc toString() {
50         return "ClassRef_MT(" + c + ", " + d + ")";
51     }
52
53     /**
54      * (obj instanceof ClassRef_MT)
55      * && (cr = ((ClassRef_MT) obj)) != null
56      * && (c == null ? cr.c == null : c.equals(cr.c))
57      * && (d == null ? cr.d == null : d.equals(cr.d));
58      * @param obj
59      * @return
60      */

61     public boolean equals(Object JavaDoc obj) {
62         Assert.assertNotNull("Null value", obj);
63         Assert.assertEquals("Bad class", ClassRef_MT.class, obj.getClass());
64         ClassRef_MT cr = (ClassRef_MT) obj;
65         Assert.assertEquals("Bad c value", c, cr.c);
66         Assert.assertEquals("Bad d value", d, cr.d);
67         return true;
68     }
69
70     //Accessors to the d field
71
public void paSetD(PName val, Object JavaDoc connection) throws PException {
72         d = val;
73     }
74
75     public PName paGetD(Object JavaDoc connection) throws PException {
76         return d;
77     }
78
79     //Accessors to the c field
80
public void paSetC(PName val, Object JavaDoc connection) throws PException {
81         c = val;
82     }
83
84     public PName paGetC(Object JavaDoc connection) throws PException {
85         return c;
86     }
87
88     public Object JavaDoc getMemoryInstance() {
89         return this;
90     }
91 }
92
Popular Tags