fulmine.util.reference
Interface IAutoCreatingStore<KEY,TYPE>

Type Parameters:
KEY - The type of the key used to access objects in this store
TYPE - The type of objects this store returns
All Superinterfaces:
IDestroyable
All Known Implementing Classes:
AutoCreatingStore

public interface IAutoCreatingStore<KEY,TYPE>
extends IDestroyable

A store of objects held against keys. Each object is returned from the store when requested by its key. The object's key is arbitrary. If the object does not exist in the store, it will be created. An object cannot be added to the store by application code.

Author:
Ramon Servadei
See Also:
IObjectBuilder

Method Summary
 void clear()
          Clear all keys and values from the store.
 boolean containsKey(KEY key)
          Find out if there is an object held against the key.
 TYPE get(KEY key)
          Get the object for the key.
 Set<KEY> keySet()
          Get a copy collection of all the keys in this store.
 TYPE remove(KEY key)
          Remove the object associated with the key.
 Collection<TYPE> values()
          Get a copy collection of the values held in this store.
 
Methods inherited from interface fulmine.IDestroyable
destroy
 

Method Detail

get

TYPE get(KEY key)
Get the object for the key. This will create an instance of the object on the first call with the key. Keys are matched based on the Object.equals(Object) method.

Parameters:
key - the key representation of the object
Returns:
an object that is the same object for all subsequent requests of this key argument

remove

TYPE remove(KEY key)
Remove the object associated with the key. The object is no longer held in this store. Subsequent calls to get(Object) for the same key may create a new object instance. Keys are matched based on the Object.equals(Object) method.

Parameters:
key - the key identifying the object that will be removed
Returns:
the object that is associated with the key argument, or null if there was no object

containsKey

boolean containsKey(KEY key)
Find out if there is an object held against the key. Keys are matched based on the Object.equals(Object) method.

Parameters:
key - the key to find
Returns:
true if there is an object held against the key

values

Collection<TYPE> values()
Get a copy collection of the values held in this store.

Returns:
a copy collection of the values held in this store.

clear

void clear()
Clear all keys and values from the store.


keySet

Set<KEY> keySet()
Get a copy collection of all the keys in this store.

Returns:
a copy set of the keys in this store.


Copyright © 2007-2009. All Rights Reserved.