private static Integer expectIntAnnotationDefaultProperty()

in TransformCore/src/main/java/com/facebook/ads/injkit/benchmark/BenchmarkInjector.java [119:143]


  private static Integer expectIntAnnotationDefaultProperty(String desc, String prop, Model model)
      throws AnnotationProcessingException {
    if (!model.knowsAnnotation(desc)) {
      throw new AnnotationProcessingException(
          String.format(Locale.US, "Annotation not known: %s", desc));
    }

    Map<String, Type> props = model.annotationProperties(desc);
    if (!props.containsKey(prop)) {
      throw new AnnotationProcessingException(
          String.format(Locale.US, "Annotation %s does not contain property %s", desc, prop));
    }

    if (!props.get(prop).equals(Type.INT_TYPE)) {
      throw new AnnotationProcessingException(
          String.format(
              Locale.US,
              "Annotation %s property %s has type %s instead of int",
              desc,
              prop,
              props.get(prop).getInternalName()));
    }

    return (Integer) model.annotationDefaultValue(desc, prop);
  }