Class AbstractResultSetMethodizer

  extended by com.evanmclean.evlib.velocity.AbstractResultSetMethodizer
All Implemented Interfaces:
Direct Known Subclasses:
ResultSetMethodizer, RowSetMethodizer

public abstract class AbstractResultSetMethodizer
extends Object
implements Iterator<AbstractResultSetMethodizer.Row>

A wrapper class around a JDBC ResultSet that allows access to the columns as properties. See ResultSetMethodizer for more information.

Evan McLean McLean Computer Services (see the overview for copyright and licensing.)

Nested Class Summary
 class AbstractResultSetMethodizer.Row
          Each row from the result set is returned as one of these objects which does the translation from property name to a column in the result set.
Constructor Summary
protected AbstractResultSetMethodizer(ResultSet rs)
protected AbstractResultSetMethodizer(ResultSetMetaData meta)
Method Summary
protected  Collection<String> getPropertyNames(String column_name)
           A way of translating column names to potential property names.
 void remove()
          Throws UnsupportedOperationException as this functionality is not supported.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
hasNext, next

Constructor Detail


protected AbstractResultSetMethodizer(ResultSet rs)
                               throws SQLException


protected AbstractResultSetMethodizer(ResultSetMetaData meta)
                               throws SQLException
Method Detail


public void remove()
Throws UnsupportedOperationException as this functionality is not supported.

Specified by:
remove in interface Iterator<AbstractResultSetMethodizer.Row>


protected Collection<String> getPropertyNames(String column_name)

A way of translating column names to potential property names. If two or more columns translate to the same property name then a VelocityException will be thrown from the constructor.

Note that the column name itself is always adding as a mapping, so you do not need to include it in the returned collection. Also, all property names are case-insensitive.

The default behaviour is to include a version of the column name with all underscore characters removed. So if your result set is based on an SQL statement such as:

 SELECT user_id
 FROM users

Then in your velocity template you could use any of the following names to match it:

column_name - The name of the column to provide mapping translations for.
null if you only want the column name itself used as a property name, or a collection of other potential column names.