private static String requireASFieldRefOfBoolEquivalentValue()

in legacy/java/piranha/src/main/java/com/uber/piranha/testannotations/TestAnnotationSpecRecord.java [105:125]


  private static String requireASFieldRefOfBoolEquivalentValue(
      JSONObject annotationJSON, String key) throws PiranhaConfigurationException {
    Object val = annotationJSON.get(key);
    if (val instanceof String) {
      if (((String) val).startsWith("$")) {
        return (String) val; // correct
      }
      // accept true/True/TRUE and false/False/FALSE
      String lowerCaseVal = ((String) val).toLowerCase(Locale.ROOT);
      if (lowerCaseVal.equals("true") || lowerCaseVal.equals("false")) {
        return lowerCaseVal; // correct
      }
    } else if (val instanceof Boolean) {
      return (((Boolean) val) ? "true" : "false"); // correct
    }
    throw new PiranhaConfigurationException(
        "Unexpected value (should be a field reference starting with '$' or a boolean value) for key "
            + key
            + " in annotation specification record: "
            + annotationJSON.toString());
  }