com.jenkov.mrpersister.impl.mapping
Class ObjectMappingCache

java.lang.Object
  extended by com.jenkov.mrpersister.impl.mapping.ObjectMappingCache
All Implemented Interfaces:
IObjectMappingCache

public class ObjectMappingCache
extends java.lang.Object
implements IObjectMappingCache


Field Summary
protected  java.util.Map objectMappings
           
 
Constructor Summary
ObjectMappingCache()
           
 
Method Summary
 void clear()
          Removes all object mappings stored in this cache.
 boolean containsObjectMapping(java.lang.Object mappingKey)
          Returns true if this cache instance contains an object method for the given mappingKey.
 IObjectMapping getObjectMapping(java.lang.Object mappingKey)
          Returns the object-to-database method for the given method key, stored in this object method cache.
 void removeObjectMapping(java.lang.Object mappingKey)
          Removes the object method stored in this cache for the given method key.
 int size()
          Returns the number of object mappings stored in this cache.
 void storeObjectMapping(java.lang.Object mappingKey, IObjectMapping mapping)
          Stores the given object-to-database method in this object method cache, under the given method key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectMappings

protected java.util.Map objectMappings
Constructor Detail

ObjectMappingCache

public ObjectMappingCache()
Method Detail

containsObjectMapping

public boolean containsObjectMapping(java.lang.Object mappingKey)
Description copied from interface: IObjectMappingCache
Returns true if this cache instance contains an object method for the given mappingKey.

Specified by:
containsObjectMapping in interface IObjectMappingCache
Parameters:
mappingKey - The method key to check if the cache contains an object method for.
Returns:
True if the cache contains object mappings for the given method key. False if not.

getObjectMapping

public IObjectMapping getObjectMapping(java.lang.Object mappingKey)
Description copied from interface: IObjectMappingCache
Returns the object-to-database method for the given method key, stored in this object method cache. If no object method is stored in the cache null is returned.

Specified by:
getObjectMapping in interface IObjectMappingCache
Returns:
The object method matching the given method key. Null if no object method was found for the given method key.

storeObjectMapping

public void storeObjectMapping(java.lang.Object mappingKey,
                               IObjectMapping mapping)
Description copied from interface: IObjectMappingCache
Stores the given object-to-database method in this object method cache, under the given method key.

Specified by:
storeObjectMapping in interface IObjectMappingCache
Parameters:
mappingKey - The method key to store this object method under.
mapping - The object method to store.

removeObjectMapping

public void removeObjectMapping(java.lang.Object mappingKey)
Description copied from interface: IObjectMappingCache
Removes the object method stored in this cache for the given method key.

Specified by:
removeObjectMapping in interface IObjectMappingCache
Parameters:
mappingKey - The key to give this particular object method.

clear

public void clear()
Description copied from interface: IObjectMappingCache
Removes all object mappings stored in this cache.

Specified by:
clear in interface IObjectMappingCache

size

public int size()
Description copied from interface: IObjectMappingCache
Returns the number of object mappings stored in this cache.

Specified by:
size in interface IObjectMappingCache
Returns:
The number of object mappings stored in this cache.