package com.logicbig.example.method;
import java.lang.reflect.Method;
public class IsAnnotationPresentExample {
private static class Test {
@Deprecated
private void process() {
}
private void init() {}
}
public static void main(String... args) throws NoSuchMethodException {
Method m = Test.class.getDeclaredMethod("process");
boolean b = m.isAnnotationPresent(Deprecated.class);
System.out.println(b);
Method m2 = Test.class.getDeclaredMethod("init");
boolean b2 = m2.isAnnotationPresent(Deprecated.class);
System.out.println(b2);
}
}