public static final Object getFieldValue(OgnlContext context, Object target, String propertyName) throws NoSuchFieldException { return getFieldValue(context, target, propertyName, false); }
public static Object getFieldValue(OgnlContext context, Object target, String propertyName, boolean checkAccessAndExistence) throws NoSuchFieldException { Object result = null; final Field f = getField((target == null) ? null : target.getClass(), propertyName); if (checkAccessAndExistence) { if ((f == null) || !context.getMemberAccess().isAccessible(context, target, f, propertyName)) { result = NotFound; } } if (result == null) { if (f == null) { throw new NoSuchFieldException(propertyName); } else { try { if (!Modifier.isStatic(f.getModifiers())) { final Object state = context.getMemberAccess().setup(context, target, f, propertyName); try { result = f.get(target); } finally { context.getMemberAccess().restore(context, target, f, propertyName, state); } } else { throw new NoSuchFieldException(propertyName); } } catch (IllegalAccessException ex) {
public static Object getFieldValue(OgnlContext context, Object target, String propertyName, boolean checkAccessAndExistence) throws NoSuchFieldException { Object result = null; final Field f = getField((target == null) ? null : target.getClass(), propertyName); if (checkAccessAndExistence) { if ((f == null) || !context.getMemberAccess().isAccessible(context, target, f, propertyName)) { result = NotFound; } } if (result == null) { if (f == null) { throw new NoSuchFieldException(propertyName); } else { try { if (!Modifier.isStatic(f.getModifiers())) { final Object state = context.getMemberAccess().setup(context, target, f, propertyName); try { result = f.get(target); } finally { context.getMemberAccess().restore(context, target, f, propertyName, state); } } else { throw new NoSuchFieldException(propertyName); } } catch (IllegalAccessException ex) {
/** Returns OgnlRuntime.NotFound if the property does not exist. */ public Object getPossibleProperty( Map context, Object target, String name) throws OgnlException { Object result; OgnlContext ognlContext = (OgnlContext)context; try { if ((result = OgnlRuntime.getMethodValue(ognlContext, target, name, true)) == OgnlRuntime.NotFound) { result = OgnlRuntime.getFieldValue(ognlContext, target, name, true); } } catch (IntrospectionException ex) { throw new OgnlException(name, ex); } catch (OgnlException ex) { throw ex; } catch (Exception ex) { throw new OgnlException(name, ex); } return result; }
/** * Returns OgnlRuntime.NotFound if the property does not exist. */ public Object getPossibleProperty(Map context, Object target, String name) throws OgnlException { Object result; OgnlContext ognlContext = (OgnlContext) context; try { if ((result = OgnlRuntime.getMethodValue(ognlContext, target, name, true)) == OgnlRuntime.NotFound) { result = OgnlRuntime.getFieldValue(ognlContext, target, name, true); } } catch (IntrospectionException ex) { throw new OgnlException(name, ex); } catch (OgnlException ex) { throw ex; } catch (Exception ex) { throw new OgnlException(name, ex); } return result; }
/** * Returns OgnlRuntime.NotFound if the property does not exist. */ public Object getPossibleProperty(Map context, Object target, String name) throws OgnlException { Object result; OgnlContext ognlContext = (OgnlContext) context; try { if ((result = OgnlRuntime.getMethodValue(ognlContext, target, name, true)) == OgnlRuntime.NotFound) { result = OgnlRuntime.getFieldValue(ognlContext, target, name, true); } } catch (IntrospectionException ex) { throw new OgnlException(name, ex); } catch (OgnlException ex) { throw ex; } catch (Exception ex) { throw new OgnlException(name, ex); } return result; }