biz.hammurapi.sql
Class ConstructorProjector

java.lang.Object
  extended by biz.hammurapi.sql.BaseReflectionProjector
      extended by biz.hammurapi.sql.ConstructorProjector
All Implemented Interfaces:
Projector

public class ConstructorProjector
extends BaseReflectionProjector
implements Projector

This projector constructs objects using database field values

Version:
$Revision: 1.2 $
Author:
Pavel Vlasov

Nested Class Summary
static class ConstructorProjector.ColumnName
           
 
Constructor Summary
ConstructorProjector(java.lang.reflect.Constructor constructor, java.util.Map typeMap)
          Use constructor for positioned projection.
ConstructorProjector(java.lang.reflect.Constructor constructor, java.lang.Object[] args, java.util.Map typeMap)
          Use this constructor if target constructor shall take not only values from database fields as parameter, but other objects as well.
ConstructorProjector(java.lang.reflect.Constructor constructor, java.lang.String[] columnNames, java.util.Map typeMap)
          Use this constructor if only database fields values are used as target constructor parameters.
 
Method Summary
 java.lang.Object project(java.sql.ResultSet rs)
          Creates object from ResultSet data
 
Methods inherited from class biz.hammurapi.sql.BaseReflectionProjector
accessorName, getColumn, getColumn, mutatorName, propertyName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstructorProjector

public ConstructorProjector(java.lang.reflect.Constructor constructor,
                            java.lang.Object[] args,
                            java.util.Map typeMap)
Use this constructor if target constructor shall take not only values from database fields as parameter, but other objects as well.

Parameters:
constructor - Constructor to instantiate object.
args - Constructor arguments. Arguments of type ConstructorProjector.ColumnName will be replaced with values from corresponding fields from the database.
typeMap - See ResultSet.getObject(java.lang.String, java.util.Map). Can be null.

ConstructorProjector

public ConstructorProjector(java.lang.reflect.Constructor constructor,
                            java.lang.String[] columnNames,
                            java.util.Map typeMap)
Use this constructor if only database fields values are used as target constructor parameters.

Parameters:
constructor - Constructor to instantiate object
columnNames - Names of columns that shall be passed as parameters to constructor.
typeMap - See ResultSet.getObject(java.lang.String, java.util.Map). Can be null.

ConstructorProjector

public ConstructorProjector(java.lang.reflect.Constructor constructor,
                            java.util.Map typeMap)
Use constructor for positioned projection. Column values will be passed to as constructor arguments according to their position.

Parameters:
constructor -
typeMap -
Method Detail

project

public java.lang.Object project(java.sql.ResultSet rs)
                         throws java.sql.SQLException
Description copied from interface: Projector
Creates object from ResultSet data

Specified by:
project in interface Projector
Parameters:
rs - ResultSet
Returns:
Constructed object
Throws:
java.sql.SQLException


Copyright © 2003 Hammurapi Group. All Rights Reserved.