KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > extractor > metadata > Attribute


1 /*
2  * This file belongs to the XQuark distribution. Copyright (C) 2003 Universite
3  * de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by the
7  * Free Software Foundation; either version 2.1 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software Foundation,
17  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307. You can also get it
18  * at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.extractor.metadata;
24
25 public class Attribute extends NamedNode {
26
27     private static final String JavaDoc RCSRevision = "$Revision: 1.7 $";
28     private static final String JavaDoc RCSName = "$Name: $";
29
30     private boolean _nullable;
31     private ExtractorMappingInfo _mappingInfo = null;
32     
33
34     /**
35      * @param name
36      * @roseuid 3B278EE3000C
37      */

38     public Attribute(String JavaDoc name) {
39         super(name);
40         _alias = name;
41     }
42
43     public Attribute(String JavaDoc name, String JavaDoc alias) {
44         super(name);
45         setAlias(alias);
46     }
47
48     /**
49      * Determines if the _nullable property is true.
50      *
51      * @return <code>true<code> if the _nullable property is true
52      */

53     public boolean getNullable() {
54         return _nullable;
55     }
56
57     /**
58      * Sets the value of the _nullable property.
59      *
60      * @param aNullable
61      * the new value of the _nullable property
62      */

63     public void setNullable(boolean aNullable) {
64         _nullable = aNullable;
65     }
66
67     /**
68      * @return org.xquark.extractor.metadata.DbPrimitiveType @roseuid
69      * 3B279390034C
70      */

71     public ExtractorMappingInfo getMappingInfo() {
72         return _mappingInfo;
73     }
74
75     /**
76      * @param type
77      * @roseuid 3B2794C301EF
78      */

79     public void setMappingInfo(ExtractorMappingInfo mappingInfo) {
80         _mappingInfo = mappingInfo;
81     }
82
83     public String JavaDoc getFullName() {
84         StringBuffer JavaDoc retVal = new StringBuffer JavaDoc();
85         String JavaDoc name = null;
86
87         name = getFather().getFather().getFather().getName();
88         if (null != name) {
89             retVal.append(name);
90             retVal.append('.');
91         }
92
93         name = getFather().getFather().getName();
94         if (null != name) {
95             retVal.append(name);
96             retVal.append('.');
97         }
98
99         name = getFather().getName();
100         if (null != name) {
101             retVal.append(name);
102             retVal.append('.');
103         }
104
105         retVal.append(_name);
106         return retVal.toString();
107     }
108
109     public String JavaDoc pprint() {
110         StringBuffer JavaDoc retVal = new StringBuffer JavaDoc();
111
112         String JavaDoc newLine = System.getProperty("line.separator");
113         retVal.append(_name);
114         retVal.append(" : ");
115         retVal.append(_mappingInfo.getDBType().pprint());
116
117         return retVal.toString();
118     }
119 }
120
Popular Tags