Esempio n. 1
0
  private void processTypeAnnotations(
      AbstractClassTypeDeclarationDescr typeDescr, TypeDeclaration type) {
    try {
      Role role = typeDescr.getTypedAnnotation(Role.class);
      if (role != null) {
        type.setRole(role.value());
      }

      TypeSafe typeSafe = typeDescr.getTypedAnnotation(TypeSafe.class);
      if (typeSafe != null) {
        type.setTypesafe(typeSafe.value());
      }

      if (typeDescr instanceof EnumDeclarationDescr) {
        type.setKind(TypeDeclaration.Kind.ENUM);
      } else if (typeDescr instanceof TypeDeclarationDescr
          && ((TypeDeclarationDescr) typeDescr).isTrait()) {
        type.setKind(TypeDeclaration.Kind.TRAIT);
      }

      type.setDynamic(typeDescr.hasAnnotation(PropertyChangeSupport.class));
    } catch (Exception e) {
      kbuilder.addBuilderResult(new TypeDeclarationError(typeDescr, e.getMessage()));
    }
  }