@Override public NormalAnnotationExpr doMerge(NormalAnnotationExpr first, NormalAnnotationExpr second) { NormalAnnotationExpr nae = new NormalAnnotationExpr(); nae.setPairs(mergeCollections(first.getPairs(),second.getPairs())); nae.setName(mergeSingle(first.getName(),second.getName())); return nae; }
/** * Visit the controller normal annotations. * <p> * We add the value of the Path annotation as the ControllerModel base Path. * </p> * @param anno {@inheritDoc} * @param controller The ControllerModel we are building. */ @Override public void visit(NormalAnnotationExpr anno, ControllerModel controller) { //org.wisdom.api.annotations.Path (There is only one pair ->value="") if(anno.getName().getName().equals(ANNOTATION_PATH)){ java.lang.String path = asString(anno.getPairs().get(0).getValue()); controller.setBasePath(path); } }
/** * 1. check the name * 2. check the member including key and value * if their size is not the same and the less one is all matched in the more one return true */ @Override public boolean doIsEquals(NormalAnnotationExpr first, NormalAnnotationExpr second) { boolean equals = true; if (!first.getName().equals(second.getName())) equals = false; if (equals == true) { if (first.getPairs() == null) return second.getPairs() == null; if (!isSmallerHasEqualsInBigger(first.getPairs(), second.getPairs(), true)) return false; } return equals; } }
@Override public void visit(NormalAnnotationExpr anno, RouteParamModel param) { if(anno.getName().getName().equals(CONSTRAINT_NOTNULL)){ param.setMandatory(true); return; if(anno.getName().getName().equals(CONSTRAINT_MIN)){ param.setMin(Long.valueOf(extractValueByName(anno.getPairs(),"value"))); return; if(anno.getName().getName().equals(CONSTRAINT_MAX)){ param.setMax(Long.valueOf(extractValueByName(anno.getPairs(), "value"))); return; if(anno.getName().getName().equals(ANNOTATION_PARAM)){ param.setParamType(PARAM); } else if(anno.getName().getName().equals(ANNOTATION_PATH_PARAM)){ param.setParamType(PATH_PARAM); } else if(anno.getName().getName().equals(ANNOTATION_QUERYPARAM)){ param.setParamType(QUERY); } else if(anno.getName().getName().equals(ANNOTATION_FORMPARAM)){ param.setParamType(FORM); } else if(anno.getName().getName().equals(ANNOTATION_DEFAULTVALUE)){ param.setDefaultValue(asString(anno.getPairs().get(0).getValue()));
if(!anno.getName().getName().equals(ANNOTATION_ROUTE)) { return;