/** * Returns whether the property name contains with a dynamic value. */ protected boolean isDynamicValue(String propName) { final ComponentCtrl compCtrl = this; Collection<Annotation> annos = compCtrl.getAnnotations(propName); if (!annos.isEmpty()) { for (Annotation anno : annos) { final String annoName = anno.getName(); if (annoName.equals(BIND_ANNO) || annoName.equals(LOAD_ANNO) || annoName.equals(SAVE_ANNO) || annoName.equals(REFERENCE_ANNO) || annoName.equals(INIT_ANNO)) { return true; } } } return false; }
public static String testString(String[] string, Annotation anno) { if (string == null || string.length == 0) { return null; } else if (string.length == 1) { return string[0]; } else { throw new IllegalSyntaxException(MiscUtil.formatLocationMessage( "only allow one string of @" + anno.getName() + ",but contains " + Arrays.toString(string), anno)); } } }
String nm = anno.getName(); try { BinderUtil.pushContext().setCurrentLocation(anno.getLocation());
private void processChildrenBindings(Component comp) { final ComponentCtrl compCtrl = (ComponentCtrl) comp; ExpressionAnnoInfo converterInfo = parseConverter(comp, CHILDREN_ATTR); //scan init first Collection<Annotation> initannos = compCtrl.getAnnotations(CHILDREN_ATTR, INIT_ANNO); if (initannos.size() > 1) { throw new IllegalSyntaxException(MiscUtil.formatLocationMessage( "Allow only one @init for " + CHILDREN_ATTR + " of " + comp, initannos.iterator().next())); } else if (initannos.size() == 1) { processChildrenInit(comp, initannos.iterator().next(), converterInfo); } Collection<Annotation> annos = compCtrl.getAnnotations(CHILDREN_ATTR); //get all annotation in the children with the order. for (Annotation anno : annos) { if (anno.getName().equals(BIND_ANNO)) { processChildrenPromptBindings(comp, anno, converterInfo); } else if (anno.getName().equals(LOAD_ANNO)) { processChildrenLoadBindings(comp, anno, converterInfo); } } ExpressionAnnoInfo templateInfo = parseTemplate(comp, CHILDREN_ATTR); if (templateInfo != null) { //use special CHILDREN_KEY to avoid conflict _binder.setTemplate(comp, CHILDREN_KEY, templateInfo.expr, templateInfo.args); } }
public void checkValidationMessages(Component comp) { final ComponentCtrl compCtrl = (ComponentCtrl) comp; for (Annotation anno : compCtrl.getAnnotations(VALIDATION_MESSAGES_ATTR)) { String nm = anno.getName(); if (ID_ANNO.equals(nm) || INIT_ANNO.equals(nm)) { continue; } try { BinderUtil.pushContext().setCurrentLocation(anno.getLocation()); _collector.addInfo( new AnnoWarnInfo(comp, VALIDATION_MESSAGES_ATTR, nm, "Unknow validation messages annotation")); } finally { BinderUtil.popContext(); } } }
public void checkBinder(Component comp) { final ComponentCtrl compCtrl = (ComponentCtrl) comp; for (Annotation anno : compCtrl.getAnnotations(BINDER_ATTR)) { String nm = anno.getName(); if (ID_ANNO.equals(nm) || INIT_ANNO.equals(nm)) { continue; } try { BinderUtil.pushContext().setCurrentLocation(anno.getLocation()); _collector.addInfo(new AnnoWarnInfo(comp, BINDER_ATTR, nm, "Unknow binder annotation")); } finally { BinderUtil.popContext(); } } }
if (anno.getName().equals(BIND_ANNO)) { if (ctx == null) { ctx = doPreInitPhase(comp, propName); } else if (anno.getName().equals(LOAD_ANNO)) { if (ctx == null) { ctx = doPreInitPhase(comp, propName); } else if (anno.getName().equals(SAVE_ANNO)) { if (ctx == null) { ctx = doPreInitPhase(comp, propName); } else if (anno.getName().equals(REFERENCE_ANNO)) { if (ctx == null) { ctx = doPreInitPhase(comp, propName);
public void checkViewModel(Component comp) { final ComponentCtrl compCtrl = (ComponentCtrl) comp; for (Annotation anno : compCtrl.getAnnotations(VIEW_MODEL_ATTR)) { String nm = anno.getName(); if (ID_ANNO.equals(nm) || INIT_ANNO.equals(nm)) { continue; } try { BinderUtil.pushContext().setCurrentLocation(anno.getLocation()); _collector.addInfo(new AnnoWarnInfo(comp, VIEW_MODEL_ATTR, nm, "Unknow viewmodel annotation")); } finally { BinderUtil.popContext(); } } }
for (String propName : annotationMap.getAnnotatedProperties()) { for (Annotation anno : annotationMap.getAnnotations(propName)) { compInfo.addAnnotation(propName, anno.getName(), anno.getAttributes(), anno.getLocation());