org.dasein.util
Class MapLoader<T>

java.lang.Object
  extended by org.dasein.util.MapLoader<T>
Type Parameters:
T - the type for elements being loaded by instances of the loader
All Implemented Interfaces:
CacheLoader<T>

public class MapLoader<T>
extends Object
implements CacheLoader<T>

Loads objects of a specific class automatically from a Map. The map should have object attribute names as keys and the values to assign to those keys as values.

Last modified: $Date: 2006/06/20 20:12:00 $

Version:
$Revision: 1.4 $
Author:
George Reese

Constructor Summary
MapLoader(Class<T> cls)
          Constructs a loader that will load values into instances of the specified class.
 
Method Summary
 T load(Object... args)
          Creates a new instance of the class this map loader is governing and loads it with values.
 void load(T item, Map vals)
          Loads the specified values into the specified object instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapLoader

public MapLoader(Class<T> cls)
Constructs a loader that will load values into instances of the specified class.

Parameters:
cls - the class for which instances will be created and loaded
Method Detail

load

public T load(Object... args)
Creates a new instance of the class this map loader is governing and loads it with values.

Specified by:
load in interface CacheLoader<T>
Parameters:
args - only one argument is expected, a Map with attribute names as keys and object values for those attributes as values
Returns:
a valid item for the cache or null

load

public void load(T item,
                 Map vals)
Loads the specified values into the specified object instance.

Parameters:
item - the object into which values are being loaded
vals - the values to load into the object


Copyright © 2011 enStratus Networks LLC. All Rights Reserved.