com.jenkov.mrpersister.impl
Class SqlCache

java.lang.Object
  extended by com.jenkov.mrpersister.impl.SqlCache
All Implemented Interfaces:
ISqlCache

public class SqlCache
extends java.lang.Object
implements ISqlCache


Field Summary
protected  java.util.Map sqlStatements
           
 
Constructor Summary
SqlCache()
           
 
Method Summary
 void clear()
          Removes all SQL statements stored in this cache.
 boolean containsStatement(java.lang.Object mappingKey)
          Returns true if the SQL cache contains a statement for the given object method key.
 java.lang.String getStatement(java.lang.Object mappingKey)
          Returns the SQL statement for this object method key.
 void removeStatement(java.lang.Object mappingKey)
          Removes the SQL statement stored for this object method key.
 int size()
          Returns the number of SQL statements stored in this cache.
 void storeStatement(java.lang.Object mappingKey, java.lang.String insertStatement)
          Stores the given string as an SQL statement for the given object method key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sqlStatements

protected java.util.Map sqlStatements
Constructor Detail

SqlCache

public SqlCache()
Method Detail

containsStatement

public boolean containsStatement(java.lang.Object mappingKey)
Description copied from interface: ISqlCache
Returns true if the SQL cache contains a statement for the given object method key. False if not.

Specified by:
containsStatement in interface ISqlCache
Parameters:
mappingKey - The object method key to check if the SQL cache contains a statement for.
Returns:
True if the SQL cache contains a statement for the given mappingkey . False if not.

getStatement

public java.lang.String getStatement(java.lang.Object mappingKey)
Description copied from interface: ISqlCache
Returns the SQL statement for this object method key. Returns null if no SQL statement is stored for this object method key in this cache.

Specified by:
getStatement in interface ISqlCache
Parameters:
mappingKey - The object method key to get the SQL statement for.
Returns:
The SQL statement for the given object method key. Null if no SQL statement is stored in the cache for the given object method key.

storeStatement

public void storeStatement(java.lang.Object mappingKey,
                           java.lang.String insertStatement)
Description copied from interface: ISqlCache
Stores the given string as an SQL statement for the given object method key.

Specified by:
storeStatement in interface ISqlCache
Parameters:
mappingKey - The object method key to store the statement for.
insertStatement - The SQL statement to store.

removeStatement

public void removeStatement(java.lang.Object mappingKey)
Description copied from interface: ISqlCache
Removes the SQL statement stored for this object method key.

Specified by:
removeStatement in interface ISqlCache
Parameters:
mappingKey - The object method to remove the statement for.

clear

public void clear()
Description copied from interface: ISqlCache
Removes all SQL statements stored in this cache.

Specified by:
clear in interface ISqlCache

size

public int size()
Description copied from interface: ISqlCache
Returns the number of SQL statements stored in this cache.

Specified by:
size in interface ISqlCache
Returns:
The number of SQL statements stored in this cache.