如何编写一个方法来接受注解类型,但实际上没有方法可以使用注解类型来传递它?
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Sharpenable {}
@Sharpenable
public class Pencil {}
public void sharpen(Sharpenable sharpenable){
System.out.println("sharpening a " + sharpenable.getClass().getSimpleName());
}