1 /*
2  * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package java.sql;
27 
28 /**
29  * <p>The standard mapping in the Java programming language for an SQL
30  * structured type. A <code>Struct</code> object contains a
31  * value for each attribute of the SQL structured type that
32  * it represents.
33  * By default, an instance of<code>Struct</code> is valid as long as the
34  * application has a reference to it.
35  * <p>
36  * All methods on the <code>Struct</code> interface must be fully implemented if the
37  * JDBC driver supports the data type.
38  * @since 1.2
39  */
40 
41 public interface Struct {
42 
43   /**
44    * Retrieves the SQL type name of the SQL structured type
45    * that this <code>Struct</code> object represents.
46    *
47    * @return the fully-qualified type name of the SQL structured
48    *          type for which this <code>Struct</code> object
49    *          is the generic representation
50    * @exception SQLException if a database access error occurs
51    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
52    * this method
53    * @since 1.2
54    */
getSQLTypeName()55   String getSQLTypeName() throws SQLException;
56 
57   /**
58    * Produces the ordered values of the attributes of the SQL
59    * structured type that this <code>Struct</code> object represents.
60    * As individual attributes are processed, this method uses the type map
61    * associated with the
62    * connection for customizations of the type mappings.
63    * If there is no
64    * entry in the connection's type map that matches the structured
65    * type that an attribute represents,
66    * the driver uses the standard mapping.
67    * <p>
68    * Conceptually, this method calls the method
69    * <code>getObject</code> on each attribute
70    * of the structured type and returns a Java array containing
71    * the result.
72    *
73    * @return an array containing the ordered attribute values
74    * @exception SQLException if a database access error occurs
75    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
76    * this method
77    * @since 1.2
78    */
getAttributes()79   Object[] getAttributes() throws SQLException;
80 
81   /**
82    * Produces the ordered values of the attributes of the SQL
83    * structured type that this <code>Struct</code> object represents.
84    *  As individual attrbutes are proccessed, this method uses the given type map
85    * for customizations of the type mappings.
86    * If there is no
87    * entry in the given type map that matches the structured
88    * type that an attribute represents,
89    * the driver uses the standard mapping. This method never
90    * uses the type map associated with the connection.
91    * <p>
92    * Conceptually, this method calls the method
93    * <code>getObject</code> on each attribute
94    * of the structured type and returns a Java array containing
95    * the result.
96    *
97    * @param map a mapping of SQL type names to Java classes
98    * @return an array containing the ordered attribute values
99    * @exception SQLException if a database access error occurs
100    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
101    * this method
102    * @since 1.2
103    */
getAttributes(java.util.Map<String,Class<?>> map)104   Object[] getAttributes(java.util.Map<String,Class<?>> map)
105       throws SQLException;
106 }
107