/** * 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; } 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; }