KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > metadata > FieldType


1 package org.apache.ojb.broker.metadata;
2
3 /* Copyright 2002-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import java.io.Serializable JavaDoc;
19
20 /**
21  * OJB implements the mapping conventions for JDBC as specified by the JDBC 3.0 specification and
22  * this class representing the jdbc java types of the sql types mappings - e.g.
23  * VARCHAR --> String, NUMERIC --> BigDecimal
24  * (see JDBC 3.0 specification <em>Appendix B, Data Type Conversion Tables</em>).
25  * <p/>
26  * We differ two types of fields, <em>immutable</em> (like Integer, Long, String, ...) and <em>mutable</em>
27  * (like Date, byte[], most SQL3 datatypes, ...).
28  *
29  * @version $Id: FieldType.java,v 1.1.2.2 2005/12/21 22:26:10 tomdz Exp $
30  */

31 public interface FieldType extends Serializable JavaDoc
32 {
33     /**
34      * Returns a copy of the specified persistent class field (e.g. Long, Integer,...).
35      * <br/>
36      * NOTE: The specified field value
37      * @param fieldValue The field to copy.
38      * @return A copy of the field or the same instance if copying is not possible. Depends on
39      * the implementation.
40      */

41     public Object JavaDoc copy(Object JavaDoc fieldValue);
42
43     /**
44      * Returns <em>true</em> if the field value hasn't changed.
45      * @param firstValue A field value object.
46      * @param secondValue A field value object.
47      * @return <em>true</em> if the field value hasn't changed.
48      */

49     public boolean equals(Object JavaDoc firstValue, Object JavaDoc secondValue);
50
51     /**
52      * Returns the sql {@link java.sql.Types} of this field.
53      */

54     public int getSqlType();
55
56     /**
57      * Dets the associated sql field type of this field.
58      * @param jdbcType The associated {@link org.apache.ojb.broker.metadata.JdbcType}.
59      */

60     public void setSqlType(JdbcType jdbcType);
61
62     /**
63      * Returns <em>true</em> if the field type is mutable, e.g. a jdbc BLOB field or
64      * jdbc TIMESTAMP field.
65      * @return
66      */

67     public boolean isMutable();
68 }
69
Popular Tags