com.calitha.reflect
Class PropertyCache

java.lang.Object
  extended by com.calitha.reflect.PropertyCache

public class PropertyCache
extends Object

The PropertyCache is used to store information about the field/properties in classes and cache them so that they can retrieved very fast at a later time.

Only fields that have both a setter and getter are stored.

The singleton pattern makes sure that only one cache exists for the application.

The PropertyCache is thread-safe to use.

Author:
Robert van Loenhout
See Also:
XMLPersistent

Constructor Summary
PropertyCache()
           
 
Method Summary
 void addProperties(Class type)
          Adds the fields/properties in a class to the cache.
 Map<String,Property> getProperties(Class type)
          Gets a map with all the fields/properties in a class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyCache

public PropertyCache()
Method Detail

getProperties

public Map<String,Property> getProperties(Class type)
Gets a map with all the fields/properties in a class.

The map has synchronized access.

Parameters:
type - class type
Returns:
map
Throws:
IllegalArgumentException - if an argument is null

addProperties

public void addProperties(Class type)
Adds the fields/properties in a class to the cache.

Fields are identified by methods that start with 'get', 'set' or 'is'.

Parameters:
type - class type
Throws:
IllegalArgumentException - if an argument is null