org.hydrateframework
Class Assembler.TestKey

java.lang.Object
  extended by org.hydrateframework.Assembler.TestKey
All Implemented Interfaces:
Assembler.Discriminator
Enclosing class:
Assembler

public static class Assembler.TestKey
extends java.lang.Object
implements Assembler.Discriminator

A Discriminator implementation for class hierarchies. This class is intended for use with queries that may populate any one of a number of different classes from a class hierarchy KeyName is the name of the key field in the table containing the most derived data for the object that this assembler is constructing. This field will be non-null if this query row is an object of that class.


Constructor Summary
Assembler.TestKey(java.lang.String keyName)
          Construct a TestKey object that will determine whether an object should be built based on whether the column with name keyName is null (do not build) or non-null (do build) in the query results row
Assembler.TestKey(java.lang.String[] keyNames)
           
 
Method Summary
 boolean prepareToProcessResults(java.sql.ResultSet rs, java.util.Map columns)
          This call gives the object an opportunity to find the column indexes of any fields of interest to the calculation
 boolean shouldBuild(Assembler bld)
          Determine if the object should be built based on information from the current row of the query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Assembler.TestKey

public Assembler.TestKey(java.lang.String keyName)
Construct a TestKey object that will determine whether an object should be built based on whether the column with name keyName is null (do not build) or non-null (do build) in the query results row

Parameters:
keyName - the name of the key column

Assembler.TestKey

public Assembler.TestKey(java.lang.String[] keyNames)
Method Detail

prepareToProcessResults

public boolean prepareToProcessResults(java.sql.ResultSet rs,
                                       java.util.Map columns)
Description copied from interface: Assembler.Discriminator
This call gives the object an opportunity to find the column indexes of any fields of interest to the calculation

Specified by:
prepareToProcessResults in interface Assembler.Discriminator
Parameters:
rs - The ResultSet object holding the data from which objects are about to be built
columns - a mapping between the names of columns found in the query and the names of attributes that this assembler's object is expecting.
Returns:
true if there were no problems

shouldBuild

public boolean shouldBuild(Assembler bld)
Description copied from interface: Assembler.Discriminator
Determine if the object should be built based on information from the current row of the query.

Specified by:
shouldBuild in interface Assembler.Discriminator
Parameters:
bld - the assembler that is about to try to build an object
Returns:
true if the object should be built, false otherwise.


Copyright © 2000 The Hydrate Project. All Rights Reserved.