public static <T extends Annotation>T of(Class<T> type,Object value){
  Method best=null;
  for (  Method method : type.getDeclaredMethods()) {
    String methodName=method.getName();
    Object def=method.getDefaultValue();
    if (methodName.equals("value") && (def == null)) {
      return of(type,Map.of("value",value));
    }
    if (def == null) {
      best=method;
    }
  }
  if (best != null) {
    return of(type,Map.of(best.getName(),value));
  }
  return of(type,Map.of("value",value));
}

public static < T extends Annotation > T of ( Class < T > type , Object value ) { Method best = null ; for ( Method method : type . getDeclaredMethods ( ) ) { String methodName = method . getName ( ) ; Object def = method . getDefaultValue ( ) ; if ( methodName . equals ( "value" ) && ( def == null ) ) { return of ( type , Map . of ( "value" , value ) ) ; } if ( def == null ) { best = method ; } } if ( best != null ) { return of ( type , Map . of ( best . getName ( ) , value ) ) ; } return of ( type , Map . of ( "value" , value ) ) ; }
create annotation instance with given values .
