code: public static <T> T getElementValue(AnnotationMirror anno, CharSequence name, Class<T> expectedType, boolean useDefaults) {
          Map<? extends ExecutableElement, ? extends AnnotationValue> valmap
                  = useDefaults
                  ? getElementValuesWithDefaults(anno)
                  : anno.getElementValues();
  
  
          for (ExecutableElement elem : valmap.keySet()) {
              if (elem.getSimpleName().contentEquals(name)) {
                  AnnotationValue val = valmap.get(elem);
                  return expectedType.cast(val.getValue());
              }
          }
          return null;
      }
docs: Get the attribute with the name {@code name} of the annotation
  {@code anno}. The result is expected to have type {@code expectedType}.
  
  
  <em>Note 1</em>: The method does not work well for attributes of an array
  type (as it would return a list of {@link AnnotationValue}s). Use
  {@code getElementValueArray} instead.
  
  
  <em>Note 2</em>: The method does not work for attributes of an enum type,
  as the AnnotationValue is a VarSymbol and would be cast to the enum type,
  which doesn't work. Use {@code getElementValueEnum} instead.
  
  @param anno         the annotation to disassemble
  @param name         the name of the attribute to access
  @param expectedType the expected type used to cast the return type
  @param useDefaults  whether to apply default values to the attribute.
  @return the value of the attribute with the given name