wt.fc
Class QueryResult

java.lang.Object
  extended by wt.fc.QueryResult
All Implemented Interfaces:
Externalizable, Serializable, Enumeration
Direct Known Subclasses:
PagingQueryResult

public class QueryResult
extends Object
implements Enumeration, Externalizable

The QueryResult class is a container of results returned from a query. Normally, these results are accessed via the Enumeration interface which is implemented by this class. The Enumeration interface provides generic access to elements of type Object. The actual runtime type for the element is based on the type of query that is performed. For simple queries using the QuerySpec where only a single class is specified in the constructor, the element type will be Persistable. For all other queries, the safest assumption is to consider the element type to be an Object array (i.e. Object[]). In the Windchill Object-to-Relational mapping, an element in the Enumeration corresponds to a row in the result set of the query. In general, multiple classes can be specified in the query so each Object is returned as an array indexed value.

An instance of this object will internally reference each item returned from a query. When processing very large result sets, this could lead to performance issues. To handle processing large results sets, the getEnumeration() method can be called to return an Enumeration which will internally "free" references as each element is returned. This will allow the result objects to be garbage collected as soon as the object is processed and no other external references exist. When using this technique, it is important to remove (e.g. set to null) any references to the QueryResult itself, after the getEnumeration() method is called.

Supported API: true

Extendable: false

See Also:
Serialized Form

Method Summary
 Enumeration getEnumeration()
          Returns an Enumeration of the results optimized to remove references to elements as they are returned.
 ObjectVectorIfc getObjectVectorIfc()
          Returns an ObjectVector of the results.
 boolean hasMoreElements()
          Indicates if more elements are available for this enumeration of the results.
 Object nextElement()
          Returns the next element in this enumeration of the results.
 Enumeration reset()
          Reset the enumeration to start of set.
 int size()
          Answer the number of objects in the result set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

size

public int size()
Answer the number of objects in the result set.

Supported API: true

Returns:
size

reset

public Enumeration reset()
Reset the enumeration to start of set.

Supported API: true

Returns:
Enumeration of objects

getEnumeration

public Enumeration getEnumeration()
Returns an Enumeration of the results optimized to remove references to elements as they are returned. For very large results sets, this method can improve performance by allowing the elements to be garbage collected as soon as the object is processed and no other external references exist. When using this method, it is important to remove (e.g. set to null) any references to the QueryResult itself after this method is called.

Supported API: true

Returns:
Enumeration of objects

hasMoreElements

public boolean hasMoreElements()
Indicates if more elements are available for this enumeration of the results.

Supported API: true

Specified by:
hasMoreElements in interface Enumeration
Returns:
true if more elements are available

nextElement

public Object nextElement()
Returns the next element in this enumeration of the results.

Supported API: true

Specified by:
nextElement in interface Enumeration
Returns:
next result object

getObjectVectorIfc

public ObjectVectorIfc getObjectVectorIfc()
Returns an ObjectVector of the results.

Supported API: true