com.stc.eindex.ejb.query
Class AttributesData

java.lang.Object
  extended bycom.stc.eindex.ejb.query.AttributesData

public class AttributesData
extends java.lang.Object

The AttributesData class provides access to the data returned from a generated SQL query through the value object assembler methods (such as those in the classes that implement the ResultObjectAssembler interface). AttributesData is a wrapper for the java.sql.ResultSet class, and is passed by the QueryResultSet class to the result object assembler so the assembler can retrieve the data from the JDBC result set.


Constructor Summary
(package private) AttributesData(java.sql.ResultSet res, java.lang.String[] attributes, int relativeIndex)
          Creates a new instance of the AttributesData class.
 
Method Summary
 java.lang.Object get(int index)
          Retrieves the information an attribute returned by the Query Manager at the specified position (the ith index).
 java.lang.Object get(java.lang.String name)
          Retrieves the information for an attribute returned by the Query Manager using the name of the attribute.
 java.lang.String[] getAttributeNames()
          Retrieves the attribute names in the current instance of the AttributesData class, calling ResultSet methods to retrieve the data.
 int size()
          Retrieves a count of the attribute names in the current instance of the AttributesData class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributesData

AttributesData(java.sql.ResultSet res,
               java.lang.String[] attributes,
               int relativeIndex)
Creates a new instance of the AttributesData class. This should not be directly created by the client.

Parameters:
res - The JDBC results of a SQL query.
attributes - The attributes of the JDBC results set.
relativeIndex - The position of the attributes data object.
Throws:
None.
Method Detail

get

public java.lang.Object get(int index)
                     throws java.sql.SQLException
Retrieves the information an attribute returned by the Query Manager at the specified position (the ith index). The index ranges from 1 to n, where n is the number of attributes for the object defined in the SELECT portion of the query object. The value of i is the SELECT field name index relative to that object. Use this method instead of get(String name) for faster retrieval.

Parameters:
index - The index of the attribute value.
Returns:
Object - The corresponding object for the ith index.
Throws:
java.sql.SQLException - Thrown if an error occurs while retrieving the attribute data.

get

public java.lang.Object get(java.lang.String name)
                     throws java.sql.SQLException
Retrieves the information for an attribute returned by the Query Manager using the name of the attribute.

Parameters:
name - The name of the attribute to retrieve.
Returns:
Object - The data corresponding to the attribute name.
Throws:
java.sql.SQLException - Thrown if an error occurs while retrieving the attribute data.

getAttributeNames

public java.lang.String[] getAttributeNames()
Retrieves the attribute names in the current instance of the AttributesData class, calling ResultSet methods to retrieve the data.

Parameters:
None.

Returns:
String[] - An array of attribute names.
Throws:
None.

size

public int size()
Retrieves a count of the attribute names in the current instance of the AttributesData class.

Parameters:
None.

Returns:
int - The number of attribute names.
Throws:
None.


Copyright 2007 by Sun Microsystems, Inc. All Rights Reserved.