Method methods = company.class.getMethod("getId", null); PK pk = methods.getAnnotation(PK.class); System.out.println("*************"+pk);