// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static List<String> getKeys(DetailAST annotationAst) {
//   List<DetailAST> keyValuePairAstList =
//       CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
//   return keyValuePairAstList.stream()
//                             .map(keyValuePairAst -> keyValuePairAst.getFirstChild().getText())
//                             .collect(Collectors.toList());
// }
// 
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
//   String[] packageNames = fullName.split("\\.");
//   return packageNames[packageNames.length - 1];
// }
// 
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static Splitter getSplitterOnComma() {
//   return Splitter.on(",").omitEmptyStrings().trimResults();
// }
// 
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static Map<String, String> splitProperty(String property) {
//   return getSplitterOnComma().withKeyValueSeparator(":").split(property);
// }


import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeys;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.CommonUtils.getSplitterOnComma;
import static es.startuphero.checkstyle.util.CommonUtils.splitProperty;
import static java.util.Objects.nonNull;
  public int[] getAcceptableTokens() {
    return new int[] {TokenTypes.ANNOTATION};
  }

  @Override
  public int[] getRequiredTokens() {
    return getAcceptableTokens();
  }

  @Override
  public void visitToken(DetailAST ast) {
    Set<String> checkedAnnotations = annotationForbiddenKeysMap.keySet();
    String annotationSimpleName = getSimpleName(ast);
    checkedAnnotations.stream()
                      .filter(checkedAnnotation -> getSimpleName(checkedAnnotation).equals(annotationSimpleName))
                      .forEach(checkedAnnotation -> {
                        List<String> annotationKeys = getKeys(ast);
                        Set<String> forbiddenKeys = annotationForbiddenKeysMap.get(checkedAnnotation);
                        for (String forbiddenKey : forbiddenKeys) {
                          if (annotationKeys.contains(forbiddenKey)) {
                            log(ast.getLineNo(), MSG_KEY, forbiddenKey, annotationSimpleName);
                          }
                        }
                      });
  }

  public void setAnnotationForbiddenKeysMap(String property) {
    if (nonNull(property)) {
      Map<String, String> annotationKeysMap = splitProperty(property);
      for (String annotation : annotationKeysMap.keySet()) {
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/AnnotationUtils.java
// public static List<String> getKeys(DetailAST annotationAst) {
//   List<DetailAST> keyValuePairAstList =
//       CommonUtils.getChildsByType(annotationAst, TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR);
//   return keyValuePairAstList.stream()
//                             .map(keyValuePairAst -> keyValuePairAst.getFirstChild().getText())
//                             .collect(Collectors.toList());
// }
// 
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static String getSimpleName(String fullName) {
//   String[] packageNames = fullName.split("\\.");
//   return packageNames[packageNames.length - 1];
// }
// 
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static Splitter getSplitterOnComma() {
//   return Splitter.on(",").omitEmptyStrings().trimResults();
// }
// 
// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/util/CommonUtils.java
// public static Map<String, String> splitProperty(String property) {
//   return getSplitterOnComma().withKeyValueSeparator(":").split(property);
// }


// Path: startupheroes-checks/src/main/java/es/startuphero/checkstyle/checks/annotation/ForbiddenAnnotationKeyCheck.java
import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static es.startuphero.checkstyle.util.AnnotationUtils.getKeys;
import static es.startuphero.checkstyle.util.CommonUtils.getSimpleName;
import static es.startuphero.checkstyle.util.CommonUtils.getSplitterOnComma;
import static es.startuphero.checkstyle.util.CommonUtils.splitProperty;
import static java.util.Objects.nonNull;

  public int[] getAcceptableTokens() {
    return new int[] {TokenTypes.ANNOTATION};
  }

  @Override
  public int[] getRequiredTokens() {
    return getAcceptableTokens();
  }

  @Override
  public void visitToken(DetailAST ast) {
    Set<String> checkedAnnotations = annotationForbiddenKeysMap.keySet();
    String annotationSimpleName = getSimpleName(ast);
    checkedAnnotations.stream()
                      .filter(checkedAnnotation -> getSimpleName(checkedAnnotation).equals(annotationSimpleName))
                      .forEach(checkedAnnotation -> {
                        List<String> annotationKeys = getKeys(ast);
                        Set<String> forbiddenKeys = annotationForbiddenKeysMap.get(checkedAnnotation);
                        for (String forbiddenKey : forbiddenKeys) {
                          if (annotationKeys.contains(forbiddenKey)) {
                            log(ast.getLineNo(), MSG_KEY, forbiddenKey, annotationSimpleName);
                          }
                        }
                      });
  }

  public void setAnnotationForbiddenKeysMap(String property) {
    if (nonNull(property)) {
      Map<String, String> annotationKeysMap = splitProperty(property);
      for (String annotation : annotationKeysMap.keySet()) {
        Iterable<String> iterableKeys = getSplitterOnComma().split(annotationKeysMap.get(annotation));