本文整理汇总了Java中com.badlogic.gdx.utils.reflect.Method.getDeclaredAnnotations方法的典型用法代码示例。如果您正苦于以下问题:Java Method.getDeclaredAnnotations方法的具体用法?Java Method.getDeclaredAnnotations怎么用?Java Method.getDeclaredAnnotations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.reflect.Method
的用法示例。
在下文中一共展示了Method.getDeclaredAnnotations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNestedGenericTypeAnnotation
import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
/**
* Gets {@code NestedGenericType} annotation from object.
* <p>
* Looks at all object methods and returns first encountered annotation.
*
* @param object Object to deal with, not null
* @return Annotation, may be null
*/
public static NestedGenericType getNestedGenericTypeAnnotation(Object object)
{
NestedGenericType result = null;
Method[] methods = ClassReflection.getMethods(object.getClass());
// TODO - use type annotation, not method?
for (Method m : methods) {
Annotation[] annotations = m.getDeclaredAnnotations();
Annotation a = m.getDeclaredAnnotation(NestedGenericType.class);
if (a != null) {
result = a.getAnnotation(NestedGenericType.class);
break;
}
}
return result;
}
示例2: getAnnotations
import com.badlogic.gdx.utils.reflect.Method; //导入方法依赖的package包/类
/** @param method will return an array of its annotations.
* @return array of annotations or null. GWT utility. */
private static com.badlogic.gdx.utils.reflect.Annotation[] getAnnotations(final Method method) {
try {
return method.getDeclaredAnnotations();
} catch (final Exception exception) {
Exceptions.ignore(exception);
return null;
}
}