com.jenkov.mrpersister.itf.mapping
Interface IObjectMappingCache

All Known Implementing Classes:
ObjectMappingCache

public interface IObjectMappingCache

The IObjectMappingCache is a cache for object mappings. The cache is designed to hold different object mappings for the same class. For instance, one object method for reading and one for writing. Also, if you need to read or write only a subset of the object fields for some part of your application, you can store an object method specialized for this purpose.

Author:
Jakob Jenkov, Jenkov Development

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.
 

Method Detail

containsObjectMapping

boolean containsObjectMapping(java.lang.Object mappingKey)
Returns true if this cache instance contains an object method for the given mappingKey.

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

IObjectMapping getObjectMapping(java.lang.Object mappingKey)
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.

Returns:
The object method matching the given method key. Null if no object method was found for the given method key.

storeObjectMapping

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.

Parameters:
mappingKey - The method key to store this object method under.
mapping - The object method to store.

removeObjectMapping

void removeObjectMapping(java.lang.Object mappingKey)
Removes the object method stored in this cache for the given method key.

Parameters:
mappingKey - The key to give this particular object method.

clear

void clear()
Removes all object mappings stored in this cache.


size

int size()
Returns the number of object mappings stored in this cache.

Returns:
The number of object mappings stored in this cache.