Ejemplo n.º 1
0
 @Override
 protected void processVariableElement(VariableElement e, DeclaredTypeName typeName) {
   if (e.getAnnotation(Deprecated.class) != null) {
     return;
   }
   if (e.getAnnotation(ColumnSpec.class) != null) {
     utils
         .getMessager()
         .printMessage(Kind.WARNING, "ColumnSpec is ignored outside of table models", e);
   }
   boolean isViewProperty = TypeConstants.isPropertyType(typeName);
   ViewQuery isViewQuery = e.getAnnotation(ViewQuery.class);
   Set<Modifier> modifiers = e.getModifiers();
   if (modifiers.containsAll(TypeConstants.PUBLIC_STATIC_FINAL)) {
     if (isViewQuery != null) {
       if (!TypeConstants.QUERY.equals(typeName)) {
         utils
             .getMessager()
             .printMessage(
                 Kind.ERROR, "ViewQuery must be an instance of " + TypeConstants.QUERY.toString());
       } else if (queryElement != null) {
         utils.getMessager().printMessage(Kind.ERROR, "Only one ViewQuery per spec allowedd");
       } else {
         viewQueryAnnotation = isViewQuery;
         queryElement = e;
       }
     } else if (!isViewProperty) {
       constantElements.add(e);
     } else {
       initializePropertyGenerator(e);
     }
   } else if (isViewProperty) {
     utils
         .getMessager()
         .printMessage(Kind.ERROR, "View properties must be public static final", e);
   } else {
     utils.getMessager().printMessage(Kind.WARNING, "Unused field in spec", e);
   }
 }