本文整理汇总了Java中com.badlogic.gdx.utils.reflect.Method.isAnnotationPresent方法的典型用法代码示例。如果您正苦于以下问题:Java Method.isAnnotationPresent方法的具体用法?Java Method.isAnnotationPresent怎么用?Java Method.isAnnotationPresent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.reflect.Method
的用法示例。
在下文中一共展示了Method.isAnnotationPresent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callPostDeserializeMethods
import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
private <T> void callPostDeserializeMethods(T object, Class<?> clazz) throws SerializationException {
Class<?> currentClass = clazz;
while (currentClass != null && !currentClass.equals(Object.class)) {
for(Method method : ClassReflection.getDeclaredMethods(currentClass)) {
if(method.isAnnotationPresent(PostDeserialize.class)) {
try {
method.invoke(object);
} catch (ReflectionException e) {
throw new SerializationException(e);
}
}
}
currentClass = currentClass.getSuperclass();
}
}
示例2: canExecuteCommand
import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
public static boolean canExecuteCommand (Console console, Method method) {
return console.isExecuteHiddenCommandsEnabled() || !method.isAnnotationPresent(HiddenCommand.class);
}
示例3: canDisplayCommand
import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
public static boolean canDisplayCommand (Console console, Method method) {
return console.isDisplayHiddenCommandsEnabled() || !method.isAnnotationPresent(HiddenCommand.class);
}
示例4: isAnnotationPresent
import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
/** Utility method kept for backwards compatibility. Annotation checking used to be problematic on GWT.
*
* @param method might contain the specified annotation. Can be null.
* @param annotationType class of the annotation that the method is checked against.
* @return true if method is annotated with the specified annotation. */
public static boolean isAnnotationPresent(final Method method, final Class<? extends Annotation> annotationType) {
return method != null && method.isAnnotationPresent(annotationType);
}