KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jalisto > se > impl > meta > FieldDescriptionImpl


1 /*
2  * Jalisto - JAva LIght STOrage
3  * Copyright (C) 2000-2005 Xcalia http://www.xcalia.com
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18  *
19  * Xcalia
20  * 71, rue Desnouettes
21  * 75014 Paris - France
22  * http://www.xcalia.com
23  */

24 package org.objectweb.jalisto.se.impl.meta;
25
26 import org.objectweb.jalisto.se.api.ClassDescription;
27 import org.objectweb.jalisto.se.api.query.FieldDescription;
28 import org.objectweb.jalisto.se.api.MetaType;
29
30 public class FieldDescriptionImpl implements FieldDescription {
31
32     public FieldDescriptionImpl(String JavaDoc fieldName, MetaType type) {
33         this.fieldName = fieldName;
34         this.type = type;
35         this.index = -1;
36         this.indexDescription = new IndexDescription(this);
37     }
38
39     public short getIndex() {
40         return index;
41     }
42
43     public void setIndex(short index) {
44         this.index = index;
45     }
46
47     public String JavaDoc getFieldName() {
48         return fieldName;
49     }
50
51     public void setFieldName(String JavaDoc fieldName) {
52         this.fieldName = fieldName;
53     }
54
55     public MetaType getType() {
56         return type;
57     }
58
59     public void setType(MetaType type) {
60         this.type = type;
61     }
62
63     public boolean isIndexDefined() {
64         return indexDescription.isIndexDefined();
65     }
66
67     public IndexDescription getIndexDescription() {
68         return indexDescription;
69     }
70
71     public ClassDescription getClassMeta() {
72         return classMeta;
73     }
74
75     public void setClassMeta(ClassDescription classMeta) {
76         this.classMeta = (ClassDescriptionImpl) classMeta;
77     }
78
79     public boolean equals(Object JavaDoc o) {
80         try {
81             FieldDescriptionImpl candidate = (FieldDescriptionImpl) o;
82             return (candidate.fieldName.equals(this.fieldName) &&
83                     (candidate.index == this.index) &&
84 // (candidate.indexDescription.equals(this.indexDescription)) &&
85
(candidate.type.equals(this.type)));
86         } catch (Exception JavaDoc e) {
87         }
88         return false;
89     }
90
91     public String JavaDoc toString() {
92         return fieldName + " : " + type.toString();
93     }
94
95     private ClassDescriptionImpl classMeta;
96     private String JavaDoc fieldName;
97     private short index;
98     private MetaType type;
99     private IndexDescription indexDescription;
100
101
102     static final long serialVersionUID = -7589377097964763559L;
103 }
104
Popular Tags