01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. 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: package java.sql;
19:
20: import java.util.Map;
21:
22: /**
23: * A manifestation of the SQL REF type - a reference to an SQL type contained in
24: * the database.
25: * <p>
26: * The SQL REF's are held in a table along with SQL structured types. Every REF
27: * has an individual identifier for each single instance. The SQL REF is used
28: * instead of the structured type it references.
29: * <p>
30: * A Ref object is stored into the database using the PreparedStatement.setRef
31: * method.
32: */
33: public interface Ref {
34:
35: /**
36: * Gets the fully-qualified SQL name of the SQL structured type that this
37: * Ref references.
38: *
39: * @return the fully qualified name of the SQL structured type
40: * @throws SQLException
41: * if there is a database error
42: */
43: public String getBaseTypeName() throws SQLException;
44:
45: /**
46: * Gets the SQL structured type instance referenced by this Ref.
47: *
48: * @return a Java object whose type is defined by the mapping for the SQL
49: * structured type.
50: * @throws SQLException
51: * if there is a database error
52: */
53: public Object getObject() throws SQLException;
54:
55: /**
56: * Returns the associated object and uses the relevant mapping to convert it
57: * to a Java type.
58: *
59: * @param map
60: * a java.util.Map which contains the mapping to use
61: * @return a Java object whose type is defined by the mapping for the SQL
62: * structured type.
63: * @throws SQLException
64: * if there is a database error
65: */
66: public Object getObject(Map<String, Class<?>> map)
67: throws SQLException;
68:
69: /**
70: * Sets the value of the structured typethat this Ref references to a
71: * supplied Object.
72: *
73: * @param value
74: * the Object representing the new SQL structured type that this
75: * Ref will reference.
76: * @throws SQLException
77: * if there is a database error
78: */
79: public void setObject(Object value) throws SQLException;
80: }
|