public static boolean setFieldValue(OgnlContext context, Object target, String propertyName, Object value) throws OgnlException { boolean result = false; try { final Field f = getField((target == null) ? null : target.getClass(), propertyName); if (f != null) { final int fModifiers = f.getModifiers(); if (!Modifier.isStatic(f.getModifiers()) && !Modifier.isFinal(fModifiers)) { final Object state = context.getMemberAccess().setup(context, target, f, propertyName); try { if (isTypeCompatible(value, f.getType()) || ((value = getConvertedType(context, target, f, propertyName, value, f.getType())) != null)) { f.set(target, value); result = true; } } finally { context.getMemberAccess().restore(context, target, f, propertyName, state); } } } } catch (IllegalAccessException ex) { throw new NoSuchPropertyException(target, propertyName, ex); } return result; }
public static boolean setFieldValue(OgnlContext context, Object target, String propertyName, Object value) throws OgnlException { boolean result = false; try { final Field f = getField((target == null) ? null : target.getClass(), propertyName); if (f != null) { final int fModifiers = f.getModifiers(); if (!Modifier.isStatic(f.getModifiers()) && !Modifier.isFinal(fModifiers)) { final Object state = context.getMemberAccess().setup(context, target, f, propertyName); try { if (isTypeCompatible(value, f.getType()) || ((value = getConvertedType(context, target, f, propertyName, value, f.getType())) != null)) { f.set(target, value); result = true; } } finally { context.getMemberAccess().restore(context, target, f, propertyName, state); } } } } catch (IllegalAccessException ex) { throw new NoSuchPropertyException(target, propertyName, ex); } return result; }
final Object state = context.getMemberAccess().setup(context, target, f, propertyName); try { result = f.get(target);
state = context.getMemberAccess().setup(context, target, f, propertyName); result = f.get(target); context.getMemberAccess().restore(context, target, f, propertyName, state);
final Object state = context.getMemberAccess().setup(context, target, f, propertyName); try { result = f.get(target);
public static final boolean setFieldValue(OgnlContext context, Object target, String propertyName, Object value) throws OgnlException { boolean result = false; try { Field f = getField( (target == null) ? null : target.getClass(), propertyName ); Object state; if ((f != null) && !Modifier.isStatic(f.getModifiers())) { state = context.getMemberAccess().setup(context, target, f, propertyName); try { if (isTypeCompatible(value, f.getType()) || ((value = getConvertedType( context, target, f, propertyName, value, f.getType())) != null)) { f.set(target, value); result = true; } } finally { context.getMemberAccess().restore(context, target, f, propertyName, state); } } } catch (IllegalAccessException ex) { throw new NoSuchPropertyException(target, propertyName, ex); } return result; }
final Object state = context.getMemberAccess().setup(context, null, f, null); try { result = f.get(null);
final Object state = context.getMemberAccess().setup(context, null, f, null); try { result = f.get(null);