private Object resolveReferenceBinding( String name, ReferenceBinding rbinding, Class<?> returnType) { BindEvaluatorX evalx = rbinding.getBinder().getEvaluatorX(); // resolve by name or by rbinding.propertyString directly? Object val = BindEvaluatorXUtil.eval(evalx, rbinding.getComponent(), name, returnType, null); // following is quick but not safe because of the null arg // val = ((ReferenceBinding)val).getValue(null); return val; }
private void processFormBindings(Component comp) { final ComponentCtrl compCtrl = (ComponentCtrl) comp; final BindEvaluatorX eval = _binder.getEvaluatorX(); // validator information ValidatorInfo validatorInfo = parseValidator(compCtrl, FORM_ATTR); String formId = null; Collection<Annotation> idannos = compCtrl.getAnnotations(FORM_ATTR, ID_ANNO); if (idannos.size() == 0) { throw new IllegalSyntaxException("@id is not found for a form binding of " + compCtrl); } else if (idannos.size() > 1) { throw new IllegalSyntaxException("Allow only one @id for a form binding of " + compCtrl); } final Annotation idanno = idannos.iterator().next(); final String idExpr = idanno.getAttribute("value"); if (idExpr != null) { formId = BindEvaluatorXUtil.eval(eval, comp, idExpr, String.class); } if (formId == null) { throw new UiException( "value of @id is not found for a form binding of " + compCtrl + ", exprssion is " + idExpr); } // scan init first Collection<Annotation> initannos = compCtrl.getAnnotations(FORM_ATTR, INIT_ANNO); if (initannos.size() > 1) { throw new IllegalSyntaxException("Allow only one @init for " + FORM_ATTR + " of " + comp); } else if (initannos.size() == 1) { processFormInit(comp, formId, initannos.iterator().next()); } Collection<Annotation> annos = compCtrl.getAnnotations(FORM_ATTR); // get all annotation in the form with the order. for (Annotation anno : annos) { if (anno.getName().equals(LOAD_ANNO)) { processFormLoadBindings(comp, formId, anno); } else if (anno.getName().equals(SAVE_ANNO)) { processFormSaveBindings(comp, formId, anno, validatorInfo); } } }
private void addCommand(Component comp, List<String> cmds, String cmdExpr) { cmds.add(BindEvaluatorXUtil.eval(_binder.getEvaluatorX(), comp, cmdExpr, String.class)); }