KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ejb > deployment > api > FieldJdbcDesc


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2004 Bull S.A.
4  * Contact: jonas-team@objectweb.org
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.1 of the License, or 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
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: FieldJdbcDesc.java,v 1.7 2004/09/17 09:44:19 joaninh Exp $
23  * --------------------------------------------------------------------------
24  */

25
26
27 package org.objectweb.jonas_ejb.deployment.api;
28
29 /**
30  * Class to hold meta-information related to a cmp-field of a bean with jdbc based store
31  * @author Christophe Ney [cney@batisseurs.com] : Initial developer
32  * @author Helene Joanin on May 2003: code cleanup
33  * @author Helene Joanin on May 2003: add sqlType.
34  */

35 // TODO : Remove this class and merge it with the FieldDesc class.
36

37 public class FieldJdbcDesc extends FieldDesc {
38
39
40     protected String JavaDoc jdbcFieldName = null;
41     protected String JavaDoc sqlType = null;
42
43     /**
44      * Get database field name in the table where bean is stored
45      * @return Name of the field in the database
46      */

47     public String JavaDoc getJdbcFieldName() {
48         return jdbcFieldName;
49     }
50
51     /**
52      * Jdbc field name setter.
53      */

54     protected void setJdbcFieldName(String JavaDoc jdbcFieldName) {
55         this.jdbcFieldName = jdbcFieldName;
56     }
57
58     /**
59      * Is the field sql-type is defined.
60      * @return true if the sql-type of the field is defined.
61      */

62     public boolean hasSqlType() {
63         return (sqlType != null);
64     }
65
66     /**
67      * Get field sql-type
68      * @return sql-type of the field in the database
69      */

70     public String JavaDoc getSqlType() {
71         return sqlType;
72     }
73
74     /**
75      * Field sql-type setter.
76      */

77     protected void setSqlType(String JavaDoc st) {
78         sqlType = st;
79     }
80
81     /**
82      * String representation of the object for test purpose
83      * @return String representation of this object
84      */

85     public String JavaDoc toString() {
86         StringBuffer JavaDoc ret = new StringBuffer JavaDoc();
87         ret.append(super.toString());
88         ret.append("\ngetJdbcFieldName()=" + getJdbcFieldName());
89         if (hasSqlType()) {
90             ret.append("\ngetSqlType()=" + getSqlType());
91         }
92         return ret.toString();
93     }
94
95 }
96
Popular Tags