KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > amber > hibernate > HibernateColumn


1 /*
2  * Copyright (c) 1998-2004 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.amber.hibernate;
30
31 import com.caucho.util.L10N;
32
33 /**
34  * configuration for an column
35  */

36 public class HibernateColumn {
37   private static final L10N L = new L10N(HibernateColumn.class);
38
39   private String _name;
40
41   private String _sqlType;
42   private int _length;
43   
44   private boolean _isNotNull;
45   private boolean _isUnique;
46   
47   private String _index;
48   private String _uniqueKey;
49
50   public void setName(String name)
51   {
52     _name = name;
53   }
54
55   String getName()
56   {
57     return _name;
58   }
59
60   public void addText(String text)
61   {
62     _name = text.trim();
63   }
64
65   /**
66    * Returns the database sql-type
67    */

68   public void setSQLType(String sqlType)
69   {
70     _sqlType = sqlType;
71   }
72
73   /**
74    * Returns the database sql-type
75    */

76   public String getSQLType()
77   {
78     return _sqlType;
79   }
80
81   /**
82    * Returns the database length
83    */

84   public void setLength(int length)
85   {
86     _length = length;
87   }
88
89   /**
90    * Returns the database length
91    */

92   public int getLength()
93   {
94     return _length;
95   }
96
97   /**
98    * Set true if the database column is not-null.
99    */

100   public void setNotNull(boolean isNotNull)
101   {
102     _isNotNull = isNotNull;
103   }
104
105   /**
106    * Set true if the database column is not-null.
107    */

108   public boolean getNotNull()
109   {
110     return _isNotNull;
111   }
112
113   /**
114    * Set true if the database column is unique.
115    */

116   public void setUnique(boolean isUnique)
117   {
118     _isUnique = isUnique;
119   }
120
121   /**
122    * Set true if the database column is unique.
123    */

124   public boolean getUnique()
125   {
126     return _isUnique;
127   }
128
129   /**
130    * Adds the column to the named unique tuple
131    */

132   public void setUniqueKey(String uniqueKey)
133   {
134     _uniqueKey = uniqueKey;
135   }
136
137   /**
138    * Returns the named unique key
139    */

140   public String getUniqueKey()
141   {
142     return _uniqueKey;
143   }
144
145   /**
146    * Adds the column to the named index
147    */

148   public void setIndex(String index)
149   {
150     _index = index;
151   }
152
153   /**
154    * Returns the index name
155    */

156   public String getIndex()
157   {
158     return _index;
159   }
160 }
161
Popular Tags