private Method getPrivateMethod ( VelMethod velMethod ) throws Exception { Field methodField = velMethod . getClass ( ) . getDeclaredField ( "method" ) ; boolean isAccessible = methodField . isAccessible ( ) ; try { methodField . setAccessible ( true ) ; return ( Method ) methodField . get ( velMethod ) ; } finally { methodField . setAccessible ( isAccessible ) ; } }
This is hackish but there s no way in Velocity to get access to the underlying Method from a VelMethod instance .