public void setValue(ELContext context, Object base, Object property, Object value) throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException { if (base instanceof DynamicPropertied) { //don't get value before check it types, , to prevent call super //BeanELResolver too early before other resolvers try { super.setValue(context, base, property, value); } catch (PropertyNotFoundException x) { context.setPropertyResolved(true); ((DynamicPropertied) base).setDynamicProperty(property.toString(), value); } } }
public Object getValue(ELContext context, Object base, Object property) throws NullPointerException, PropertyNotFoundException, ELException { if (context == null) { throw new NullPointerException(); } Object val = null; if (base instanceof DynamicPropertied) { //don't get value before check it types(DynamicPropertied), to prevent call super //BeanELResolver too early before other resolvers try { val = super.getValue(context, base, property); } catch (PropertyNotFoundException x) { if (((DynamicPropertied) base).hasDynamicProperty(property.toString())) { context.setPropertyResolved(true); val = ((DynamicPropertied) base).getDynamicProperty(property.toString()); } else { context.setPropertyResolved(false); //super always set resolved to true, reset it } } } return val; }
if (dpcomp.hasDynamicProperty(_attr)) { dpcomp.setDynamicProperty(_attr, bean); } else { throw UiException.Aide.wrap(ex);
public Object evaluate(XelContext ctx) throws XelException { try { if (cmp instanceof ComponentCtrl) { PropertyAccess propertyAccess = ((ComponentCtrl) cmp).getPropertyAccess(field); if (propertyAccess != null) return propertyAccess.getValue(cmp); } return Fields.get(cmp, field); } catch (NoSuchMethodException e) { if (cmp instanceof DynamicPropertied) { return ((DynamicPropertied) cmp).getDynamicProperty(field); } return null; } }
/** Assigns a property. * * <p>Don't use the reflection directly since this method searches * more signatures. * * @exception PropertyNotFoundException if the property is not found, * i.e., no corresponding method and {@link DynamicPropertied} not * implemented. * @exception UiException if fail to assign * @since 3.5.0 */ public static final void assign(Component comp, String name, String value) { final Method mtd = resolveMethod(comp.getClass(), name); if (mtd != null) { try { Object val = Classes.coerce(mtd.getParameterTypes()[0], value); mtd.invoke(comp, val); } catch (Exception ex) { log.error("Failed to assign " + value + " to " + comp + "\n" + Exceptions.getMessage(ex)); throw UiException.Aide.wrap(ex); } } else { ((DynamicPropertied) comp).setDynamicProperty(name, value); } }
if (dpcomp.hasDynamicProperty(_attr)) { rawval = dpcomp.getDynamicProperty(_attr); } else { throw UiException.Aide.wrap(ex);
((DynamicPropertied)target).setDynamicProperty(attnm, value); else Fields.setByCompound(target, attnm, value, true); ((DynamicPropertied)target).setDynamicProperty(attnm, value); else Fields.setByCompound(target, attnm, value, true);
public void setValue(XelContext ctx, Object value) throws XelException { try { if (cmp instanceof ComponentCtrl) { PropertyAccess propertyAccess = ((ComponentCtrl) cmp).getPropertyAccess(field); if (propertyAccess != null) { try { propertyAccess.setValue(cmp, Classes.coerce(propertyAccess.getType(), value)); return; // done } catch (ClassCastException cce) { // yes, ignore it here and use the old EL way. } } } Fields.set(cmp, field, value, true); } catch (NoSuchMethodException e) { if (cmp instanceof DynamicPropertied) { ((DynamicPropertied) cmp).setDynamicProperty(field, value); } } }
} else if (mtds == null) { ((DynamicPropertied) comp).setDynamicProperty(_name, val); return; //done } else { //mtds != null && val != null