private static Object invokeGetter ( Object obj , String methodName , Object defaultValue ) { try { Method method = obj . getClass ( ) . getMethod ( methodName , new Class [ 0 ] ) ; Object result = method . invoke ( obj , new Object [ 0 ] ) ; return result ; } catch ( NoSuchMethodException e ) { return defaultValue ; } catch ( IllegalAccessException e ) { return defaultValue ; } catch ( InvocationTargetException e ) { return defaultValue ; } }
Invokes the specified getter method if it exists .