i am writing one function in hibernate to recursively initialize all properties of object recursively so whole object graph is loaded.
i have two complex scenarios w
Full code:
public T recursiveInitliaze(T obj) {
Set
Code of ReflectionUtils:
/**
* Handle the given reflection exception. Should only be called if no
* checked exception is expected to be thrown by the target method.
* Throws the underlying RuntimeException or Error in case of an
* InvocationTargetException with such a root cause. Throws an
* IllegalStateException with an appropriate message else.
* @param ex the reflection exception to handle
*/
public static void handleReflectionException(Exception ex) {
if (ex instanceof NoSuchMethodException) {
throw new IllegalStateException("Method not found: " + ex.getMessage());
}
if (ex instanceof IllegalAccessException) {
throw new IllegalStateException("Could not access method: " + ex.getMessage());
}
if (ex instanceof InvocationTargetException) {
handleInvocationTargetException((InvocationTargetException) ex);
}
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
}
throw new UndeclaredThrowableException(ex);
}