Home | History | Annotate | Download | only in sql
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  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 package java.sql;
     19 
     20 import java.util.Map;
     21 
     22 /**
     23  * An interface which provides facilities for manipulating an SQL structured type
     24  * as a Java object. The {@code Struct} object has a value for each attribute of the SQL structured
     25  * type.
     26  */
     27 public interface Struct {
     28 
     29     /**
     30      * Gets the SQL Type name of the SQL structured type that this {@code
     31      * Struct} represents.
     32      *
     33      * @return the fully qualified name of SQL structured type.
     34      * @throws SQLException
     35      *             if a database error occurs.
     36      */
     37     public String getSQLTypeName() throws SQLException;
     38 
     39     /**
     40      * Gets the values of the attributes of this SQL structured type. This
     41      * method uses the type map associated with the {@link Connection} for
     42      * customized type mappings. Where there is no entry in the type mapping
     43      * which matches this structured type, the JDBC driver uses the standard
     44      * mapping.
     45      *
     46      * @return an {@code Object} array containing the ordered attributes.
     47      * @throws SQLException
     48      *             if a database error occurs.
     49      */
     50     public Object[] getAttributes() throws SQLException;
     51 
     52     /**
     53      * Gets the values of the attributes of this SQL structured type. This
     54      * method uses the supplied type mapping to determine how to map SQL types
     55      * to their corresponding Java objects. In the
     56      * case where there is no entry in the type mapping which matches this
     57      * structured type, the JDBC driver uses the default mapping. The {@code
     58      * Connection} type map is <i>never</i> utilized by this method.
     59      *
     60      * @param theMap
     61      *            a Map describing how SQL Type names are mapped to classes.
     62      * @return an Object array containing the ordered attributes,.
     63      * @throws SQLException
     64      *             if a database error occurs.
     65      */
     66     public Object[] getAttributes(Map<String, Class<?>> theMap)
     67             throws SQLException;
     68 }
     69