public static final boolean setMethodValue(OgnlContext context, Object target, String propertyName, Object value) throws OgnlException, IllegalAccessException, NoSuchMethodException, MethodFailedException, IntrospectionException { return setMethodValue(context, target, propertyName, value, false); }
/** * Returns OgnlRuntime.NotFound if the property does not exist. */ public Object setPossibleProperty(Map context, Object target, String name, Object value) throws OgnlException { Object result = null; OgnlContext ognlContext = (OgnlContext) context; try { if (!OgnlRuntime.setMethodValue(ognlContext, target, name, value, true)) { result = OgnlRuntime.setFieldValue(ognlContext, target, name, value) ? null : OgnlRuntime.NotFound; } if (result == OgnlRuntime.NotFound) { Method m = OgnlRuntime.getWriteMethod(target.getClass(), name); if (m != null) { result = m.invoke(target, new Object[] { value}); } } } 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 setPossibleProperty( Map context, Object target, String name, Object value) throws OgnlException { Object result = null; OgnlContext ognlContext = (OgnlContext)context; try { if (!OgnlRuntime.setMethodValue(ognlContext, target, name, value, true)) { result = OgnlRuntime.setFieldValue(ognlContext, target, name, value) ? null : OgnlRuntime.NotFound; } } 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 setPossibleProperty(Map context, Object target, String name, Object value) throws OgnlException { Object result = null; OgnlContext ognlContext = (OgnlContext) context; try { if (!OgnlRuntime.setMethodValue(ognlContext, target, name, value, true)) { result = OgnlRuntime.setFieldValue(ognlContext, target, name, value) ? null : OgnlRuntime.NotFound; } if (result == OgnlRuntime.NotFound) { Method m = OgnlRuntime.getWriteMethod(target.getClass(), name); if (m != null) { result = m.invoke(target, new Object[] { value}); } } } catch (IntrospectionException ex) { throw new OgnlException(name, ex); } catch (OgnlException ex) { throw ex; } catch (Exception ex) { throw new OgnlException(name, ex); } return result; }
public static boolean setMethodValue(OgnlContext context, Object target, String propertyName, Object value, boolean checkAccessAndExistence) throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException { boolean result = true; Method m = getSetMethod(context, (target == null) ? null : target.getClass(), propertyName); if (checkAccessAndExistence) { if ((m == null) || !context.getMemberAccess().isAccessible(context, target, m, propertyName)) { result = false; } } if (result) { if (m != null) { Object[] args = _objectArrayPool.create(value); try { callAppropriateMethod(context, target, target, m.getName(), propertyName, Collections.nCopies(1, m), args); } finally { _objectArrayPool.recycle(args); } } else
public static boolean setMethodValue(OgnlContext context, Object target, String propertyName, Object value, boolean checkAccessAndExistence) throws OgnlException, IllegalAccessException, NoSuchMethodException, IntrospectionException { boolean result = true; Method m = getSetMethod(context, (target == null) ? null : target.getClass(), propertyName); if (checkAccessAndExistence) { if ((m == null) || !context.getMemberAccess().isAccessible(context, target, m, propertyName)) { result = false; } } if (result) { if (m != null) { Object[] args = _objectArrayPool.create(value); try { callAppropriateMethod(context, target, target, m.getName(), propertyName, Collections.nCopies(1, m), args); } finally { _objectArrayPool.recycle(args); } } else