public static final Object getMethodValue ( OgnlContext context , Object target , String propertyName , boolean checkAccessAndExistence ) throws OgnlException , IllegalAccessException , NoSuchMethodException , IntrospectionException { Object result = null ; Method m = getGetMethod ( context , ( target == null ) ? null : target . getClass ( ) , propertyName ) ; if ( m == null ) m = getReadMethod ( ( target == null ) ? null : target . getClass ( ) , propertyName , null ) ; if ( checkAccessAndExistence ) { if ( ( m == null ) || ! context . getMemberAccess ( ) . isAccessible ( context , target , m , propertyName ) ) { result = NotFound ; } } if ( result == null ) { if ( m != null ) { try { result = invokeMethod ( target , m , NoArguments ) ; } catch ( InvocationTargetException ex ) { throw new OgnlException ( propertyName , ex . getTargetException ( ) ) ; } } else { throw new NoSuchMethodException ( propertyName ) ; } } return result ; }
If the checkAccessAndExistence flag is true this method will check to see if the method exists and if it is accessible according to the context s MemberAccess . If neither test passes this will return NotFound .