protected void checkTemplateMethod(TypeElement bundleType, LabelTemplateMethod method) { if (isEmpty(method.getMobile())) { processingEnv.getMessager().printMessage(Kind.WARNING, "mobile message is empty", bundleType); } if (method.getBase().equals(method.getMobile(false))) { processingEnv .getMessager() .printMessage( Kind.WARNING, method.getName() + ": duplicate mobile & desktop messages, mobile value can be removed", bundleType); } }
private void processLabels(TypeElement resourcesType, List<LabelTemplateMethod> methods) { for (Element element : resourcesType.getEnclosedElements()) { if (element.getKind() != ElementKind.METHOD) { continue; } final ExecutableElement method = (ExecutableElement) element; Message labelAnnotation = element.getAnnotation(Message.class); final TemplateParam returnType = new TemplateParam(method.getReturnType().toString()); final boolean deprecated = method.getAnnotation(Deprecated.class) != null; final LabelTemplateMethod labelMethod; try { labelMethod = new LabelTemplateMethod( method.getSimpleName().toString(), deprecated, returnType, labelAnnotation.value(), labelAnnotation.mobile()); } catch (Throwable t) { processingEnv.getMessager().printMessage(Kind.WARNING, t.getMessage(), resourcesType); continue; } for (VariableElement variable : method.getParameters()) { final String paramName = variable.getSimpleName().toString(); final String paramType = variable.asType().toString(); List<TemplateAnnotation> annotations = new ArrayList<TemplateAnnotation>(); for (AnnotationMirror annotationMirrors : variable.getAnnotationMirrors()) { annotations.add(new TemplateAnnotation(annotationMirrors.getAnnotationType().toString())); } labelMethod.getParams().add(new TemplateParam(paramType, paramName, annotations)); } methods.add(labelMethod); } }