net.sf.jagg
Class MethodCache

java.lang.Object
  extended by net.sf.jagg.MethodCache

public class MethodCache
extends java.lang.Object

Created as a wrapper around a HashMap that maps property names to Methods.

Since:
0.1.0
Author:
Randy Gettman

Method Summary
static MethodCache getMethodCache()
          Returns the singleton MethodCache.
 MethodCall getMethodCallFromProperty(java.lang.Object value, java.lang.String property)
          Gets a specific MethodCall from the cache, or creates it by finding the Method using reflection if it does not exist.
 java.lang.Object getValueFromProperty(java.lang.Object value, java.lang.String property)
          Gets a specific Method from the cache, or finds it using reflection if it does not exist.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMethodCache

public static MethodCache getMethodCache()
Returns the singleton MethodCache.

Returns:
The singleton MethodCache.

getValueFromProperty

public java.lang.Object getValueFromProperty(java.lang.Object value,
                                             java.lang.String property)
                                      throws java.lang.NoSuchMethodException,
                                             java.lang.IllegalAccessException,
                                             java.lang.reflect.InvocationTargetException
Gets a specific Method from the cache, or finds it using reflection if it does not exist. Invokes the Method and returns the value.

Parameters:
value - The object on which to lookup a property value.
property - The property or method name plus signature to lookup.
Returns:
The object's property value.
Throws:
java.lang.NoSuchMethodException - If a suitable Method couldn't be found.
java.lang.IllegalAccessException - If the Method is inaccessible (private, etc.)
java.lang.reflect.InvocationTargetException - If the Method throws an Exception during execution.

getMethodCallFromProperty

public MethodCall getMethodCallFromProperty(java.lang.Object value,
                                            java.lang.String property)
                                     throws java.lang.NoSuchMethodException
Gets a specific MethodCall from the cache, or creates it by finding the Method using reflection if it does not exist.

Parameters:
value - The object on which to lookup a property value.
property - The property or method name plus signature to lookup.
Returns:
A MethodCall.
Throws:
java.lang.NoSuchMethodException - If a suitable Method couldn't be found.
Since:
0.5.0


Copyright © 2010-2013 jAgg Team. All Rights Reserved.