dk.vajhoej.record
Class StructInfoCache

java.lang.Object
  extended by dk.vajhoej.record.StructInfoCache

public class StructInfoCache
extends java.lang.Object

Class StructInfoCache caches StructInfo objects in a singleton cache.


Method Summary
static
<T> StructInfo
analyze(java.lang.Class<T> t)
          Convenience method to get StructInfo from cache and analyze class if not in cache.
 StructInfo get(java.lang.Class<?> clz)
          Get StructInfo from cache.
 double getHitRate()
          Get cache hit rate.
static StructInfoCache getInstance()
          Get singleton instance.
 void put(java.lang.Class<?> clz, StructInfo si)
          Put StructInfo into cache.
 void reset()
          Reset cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static StructInfoCache getInstance()
Get singleton instance.

Returns:
instance

get

public StructInfo get(java.lang.Class<?> clz)
Get StructInfo from cache.

Parameters:
clz - class we want StructInfo for
Returns:
StructInfo

put

public void put(java.lang.Class<?> clz,
                StructInfo si)
Put StructInfo into cache.

Parameters:
clz - class we have StructInfo for
si - StructInfo

getHitRate

public double getHitRate()
Get cache hit rate.

Returns:
hit rate

reset

public void reset()
Reset cache.


analyze

public static <T> StructInfo analyze(java.lang.Class<T> t)
                          throws RecordException
Convenience method to get StructInfo from cache and analyze class if not in cache.

Parameters:
t - class
Returns:
StructInfo StructInfo for class
Throws:
RecordException - if error analyzing cache