1 /* 2 * @(#)Struct.java 1.22 04/05/05 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.sql; 9 10 /** 11 * <p>The standard mapping in the Java programming language for an SQL 12 * structured type. A <code>Struct</code> object contains a 13 * value for each attribute of the SQL structured type that 14 * it represents. 15 * By default, an instance of<code>Struct</code> is valid as long as the 16 * application has a reference to it. 17 * @since 1.2 18 */ 19 20 public interface Struct { 21 22 /** 23 * Retrieves the SQL type name of the SQL structured type 24 * that this <code>Struct</code> object represents. 25 * 26 * @return the fully-qualified type name of the SQL structured 27 * type for which this <code>Struct</code> object 28 * is the generic representation 29 * @exception SQLException if a database access error occurs 30 */ 31 String getSQLTypeName() throws SQLException; 32 33 /** 34 * Produces the ordered values of the attributes of the SQL 35 * structurec type that this <code>Struct</code> object represents. 36 * This method uses the type map associated with the 37 * connection for customizations of the type mappings. 38 * If there is no 39 * entry in the connection's type map that matches the structured 40 * type that this <code>Struct</code> object represents, 41 * the driver uses the standard mapping. 42 * <p> 43 * Conceptually, this method calls the method 44 * <code>getObject</code> on each attribute 45 * of the structured type and returns a Java array containing 46 * the result. 47 * 48 * @return an array containing the ordered attribute values 49 * @exception SQLException if a database access error occurs 50 */ 51 Object[] getAttributes() throws SQLException; 52 53 /** 54 * Produces the ordered values of the attributes of the SQL 55 * structurec type that this <code>Struct</code> object represents. 56 * This method uses the given type map 57 * for customizations of the type mappings. 58 * If there is no 59 * entry in the given type map that matches the structured 60 * type that this <code>Struct</code> object represents, 61 * the driver uses the standard mapping. This method never 62 * uses the type map associated with the connection. 63 * <p> 64 * Conceptually, this method calls the method 65 * <code>getObject</code> on each attribute 66 * of the structured type and returns a Java array containing 67 * the result. 68 * 69 * @param map a mapping of SQL type names to Java classes 70 * @return an array containing the ordered attribute values 71 * @exception SQLException if a database access error occurs 72 */ 73 Object[] getAttributes(java.util.Map<String,Class<?>> map) 74 throws SQLException; 75 } 76 77 78