01: package org.apache.ojb.broker.metadata;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * 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;
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 {
32: /**
33: * Returns a copy of the specified persistent class field (e.g. Long, Integer,...).
34: * <br/>
35: * NOTE: The specified field value
36: * @param fieldValue The field to copy.
37: * @return A copy of the field or the same instance if copying is not possible. Depends on
38: * the implementation.
39: */
40: public Object copy(Object fieldValue);
41:
42: /**
43: * Returns <em>true</em> if the field value hasn't changed.
44: * @param firstValue A field value object.
45: * @param secondValue A field value object.
46: * @return <em>true</em> if the field value hasn't changed.
47: */
48: public boolean equals(Object firstValue, Object secondValue);
49:
50: /**
51: * Returns the sql {@link java.sql.Types} of this field.
52: */
53: public int getSqlType();
54:
55: /**
56: * Dets the associated sql field type of this field.
57: * @param jdbcType The associated {@link org.apache.ojb.broker.metadata.JdbcType}.
58: */
59: public void setSqlType(JdbcType jdbcType);
60:
61: /**
62: * Returns <em>true</em> if the field type is mutable, e.g. a jdbc BLOB field or
63: * jdbc TIMESTAMP field.
64: * @return
65: */
66: public boolean isMutable();
67: }
|