Class KeyPathHelper


public class KeyPathHelper
extends java.lang.Object

This class executes recursive getter methods (no parameters) using reflection. i.e. If you have an Employee instance that has a Manager instance, you could get the name of the employees manager with this key path string: "getManager.getName"

Inner Class Summary
static class KeyPathHelper.KeyPathException
Constructor Summary
Method Summary
static java.lang.Object getValueForKeyPath(java.lang.Object obj, java.lang.String keyPath)
          Recursively execute methods on the result of the previous method.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public KeyPathHelper()
Method Detail


public static java.lang.Object getValueForKeyPath(java.lang.Object obj,
                                                  java.lang.String keyPath)
                                           throws KeyPathHelper.KeyPathException
Recursively execute methods on the result of the previous method.
obj - a value of type 'Object' - i.e. an Employee instance
keyPath - a value of type 'String' - i.e. "getManager.getName"
a value of type 'Object' - i.e. returns the managers name