/*
 * @(#)Struct.java	1.9 98/05/26
 * 
 * Copyright 1998 by Sun Microsystems, Inc.,
 * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of Sun Microsystems, Inc. ("Confidential Information").  You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with Sun.
 */

package java.sql;
 
/**
 * JDBC 2.0
 *
 * <p>The Struct interface represents the default mapping for an SQL
 * structured type.  By default, the contents of a Struct are
 * materialized when the structured instance is produced.  And,
 * by default, an instance of Struct is valid as long as the 
 * application has a reference to it.
 */

public interface Struct {

  /**
   * @returns the fully qualified type name of the SQL structured 
   * type for which this is the generic representation.
   */
  String getSQLTypeName() throws SQLException;

  /**
   * Produce the ordered values of the attributes of the SQL 
   * structured type. Use the type-map associated with the 
   * connection for customizations of the type-mappings.
   *
   * Conceptually, this method calls getObject() on each attribute
   * of the structured type and returns a Java array containing 
   * the result.
   *
   * @return an array containing the ordered attribute values
   */
  Object[] getAttributes() throws SQLException;

  /**
   * Produce the ordered values of the attributes of the SQL 
   * structured type. Use the given @map for type-map 
   * customizations.
   *
   * Conceptually, this method calls getObject() on each attribute
   * of the structured type and returns a Java array containing
   * the result.
   *
   * @param map contains mapping of SQL type names to Java classes
   * @return an array containing the ordered attribute values
   */
  Object[] getAttributes(java.util.Map map) throws SQLException;
}


