gov.usda.gdpc.database
Class AbstractDatabaseMapping

java.lang.Object
  extended bygov.usda.gdpc.database.AbstractDatabaseMapping
All Implemented Interfaces:
DatabaseMapping
Direct Known Subclasses:
ConstantDatabaseMapping, MultiDatabaseMapping, NullDatabaseMapping, PanzeaPositionMinutesDatabaseMapping, SimpleDatabaseMapping

public abstract class AbstractDatabaseMapping
extends java.lang.Object
implements DatabaseMapping

This class provides a skeletal implementation of the DatabaseMapping interface, to minimize the effort required to implement this interface.

Author:
terryc

Field Summary
protected  Property myProperty
          Property associated with this database mapping
 
Constructor Summary
AbstractDatabaseMapping(Property property)
          AbstractDatabaseMapping Constructor.
 
Method Summary
 SQLStatements getDistinctSQL()
          Returns the SQL statements required to get the distinct values for the property associated with this mapping.
 java.util.List getJavaObjects(java.sql.ResultSet rs, ExtraInfo extraInfo)
          Gets the data from the given result set as Java objects.
 Property getProperty()
          Gets the property associated with this database mapping.
 java.lang.String getSQLSubString(Filter filter, ExtraInfo extraInfo)
          Gets the SQL sub-string based on the given filter.
 java.lang.String toString()
          Returns the string representation of this database mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myProperty

protected final Property myProperty
Property associated with this database mapping

Constructor Detail

AbstractDatabaseMapping

public AbstractDatabaseMapping(Property property)
AbstractDatabaseMapping Constructor.

Parameters:
property - associated property
Method Detail

getProperty

public Property getProperty()
Gets the property associated with this database mapping.

Specified by:
getProperty in interface DatabaseMapping
Returns:
the property

getSQLSubString

public java.lang.String getSQLSubString(Filter filter,
                                        ExtraInfo extraInfo)
Gets the SQL sub-string based on the given filter.

Specified by:
getSQLSubString in interface DatabaseMapping
Parameters:
filter - filter
extraInfo - this is extra information that can be used by this database mapping to generate the SQL.
Returns:
SQL sub-string

getJavaObjects

public java.util.List getJavaObjects(java.sql.ResultSet rs,
                                     ExtraInfo extraInfo)
                              throws java.sql.SQLException
Gets the data from the given result set as Java objects. The actual type of objects returned will match what's specified by the property associated with this mapping.

Specified by:
getJavaObjects in interface DatabaseMapping
Parameters:
rs - result set
extraInfo - this is extra information that can be used by this database mapping to generate the Java objects.
Returns:
list of converted data
Throws:
java.sql.SQLException

getDistinctSQL

public SQLStatements getDistinctSQL()
Returns the SQL statements required to get the distinct values for the property associated with this mapping.

Specified by:
getDistinctSQL in interface DatabaseMapping
Returns:
SQL statements and corresponding extra information

toString

public java.lang.String toString()
Returns the string representation of this database mapping.

Returns:
string representation