@Test
public void getMethodType() {
List<Method> methodList = Arrays.asList(UpdateInfoPushServiceItf.class.getDeclaredMethods());
methodList.forEach(method -> System.out.println(Modifier.toString(method.getModifiers())));
}
@Test
public void getFieldType() {
List<Field> fieldList = Arrays.asList(UpdateInfoPushConst.class.getDeclaredFields());
fieldList.forEach(field -> System.out.println(Modifier.toString(field.getModifiers())));
}
输出
public static final
public static final
public static final
public static final
参考资料:
1、Java反射之如何判断类或变量、方法的修饰符(Modifier解析)