| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| JdbcType |
|
| 1.0;1 |
| 1 | package org.apache.ojb.broker.metadata; | |
| 2 | ||
| 3 | /* Copyright 2003-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.sql.ResultSet; | |
| 19 | import java.sql.CallableStatement; | |
| 20 | import java.sql.SQLException; | |
| 21 | import java.io.Serializable; | |
| 22 | ||
| 23 | import org.apache.ojb.broker.util.sequence.SequenceManagerException; | |
| 24 | ||
| 25 | /** | |
| 26 | * Represents a jdbc sql type object defined by the JDBC 3.0 specification to handle | |
| 27 | * data conversion (see JDBC 3.0 specification <em>Appendix B, Data Type Conversion Tables</em>). | |
| 28 | * | |
| 29 | * @see FieldType | |
| 30 | * @version $Id: JdbcType.java,v 1.1 2007-08-24 22:17:29 ewestfal Exp $ | |
| 31 | */ | |
| 32 | public interface JdbcType extends Serializable | |
| 33 | { | |
| 34 | /** | |
| 35 | * Intern used flag. | |
| 36 | */ | |
| 37 | public static final int MIN_INT = Integer.MIN_VALUE; | |
| 38 | ||
| 39 | /** | |
| 40 | * Returns an java object for this jdbc type by extract from the given | |
| 41 | * CallableStatement or ResultSet. | |
| 42 | * <br/> | |
| 43 | * NOTE: For internal use only!! | |
| 44 | * <br/> | |
| 45 | * Exactly one of the arguments of type CallableStatement or ResultSet | |
| 46 | * have to be non-null. If the 'columnId' argument is equals {@link #MIN_INT}, then the given 'columnName' | |
| 47 | * argument is used to lookup column. Else the given 'columnId' is used as column index. | |
| 48 | */ | |
| 49 | public Object getObjectFromColumn(ResultSet rs, CallableStatement stmt, String columnName, int columnId) | |
| 50 | throws SQLException; | |
| 51 | ||
| 52 | /** | |
| 53 | * Convenience method for {@link #getObjectFromColumn(ResultSet, CallableStatement, String, int)} | |
| 54 | */ | |
| 55 | public Object getObjectFromColumn(CallableStatement stmt, int columnId) throws SQLException; | |
| 56 | ||
| 57 | /** | |
| 58 | * Convenience method for {@link #getObjectFromColumn(ResultSet, CallableStatement, String, int)} | |
| 59 | */ | |
| 60 | public Object getObjectFromColumn(ResultSet rs, String columnName) throws SQLException; | |
| 61 | ||
| 62 | /** | |
| 63 | * Convert the given {@link java.lang.Long} value to | |
| 64 | * a java object representation of this jdbc type. | |
| 65 | */ | |
| 66 | public Object sequenceKeyConversion(Long identifier) throws SequenceManagerException; | |
| 67 | ||
| 68 | /** | |
| 69 | * Returns the representing {@link java.sql.Types sql type}. | |
| 70 | */ | |
| 71 | public int getType(); | |
| 72 | ||
| 73 | /** | |
| 74 | * Indicates whether some other object is "equal to" this one. | |
| 75 | */ | |
| 76 | public boolean equals(Object obj); | |
| 77 | ||
| 78 | /** | |
| 79 | * Returns the associated {@link FieldType} (java field type mapped to this sql type). | |
| 80 | */ | |
| 81 | public FieldType getFieldType(); | |
| 82 | ||
| 83 | // // not used in code, but maybe useful in further versions | |
| 84 | // /** | |
| 85 | // * Convenience method for {@link #getObjectFromColumn(ResultSet, CallableStatement, String, int)} | |
| 86 | // */ | |
| 87 | // Object getObjectFromColumn(CallableStatement stmt, String columnName) throws SQLException; | |
| 88 | // /** | |
| 89 | // * Convenience method for {@link #getObjectFromColumn(ResultSet, CallableStatement, String, int)} | |
| 90 | // */ | |
| 91 | // Object getObjectFromColumn(ResultSet rs, int columnId) throws SQLException; | |
| 92 | } |