1 package com.badlogic.gdx.utils.reflect; 2 3 /** Provides information about, and access to, an annotation of a field, class or interface. 4 * @author dludwig */ 5 public final class Annotation { 6 7 private java.lang.annotation.Annotation annotation; 8 Annotation(java.lang.annotation.Annotation annotation)9 Annotation (java.lang.annotation.Annotation annotation) { 10 this.annotation = annotation; 11 } 12 13 @SuppressWarnings("unchecked") getAnnotation(Class<T> annotationType)14 public <T extends java.lang.annotation.Annotation> T getAnnotation (Class<T> annotationType) { 15 if (annotation.annotationType().equals(annotationType)) { 16 return (T) annotation; 17 } 18 return null; 19 } 20 getAnnotationType()21 public Class<? extends java.lang.annotation.Annotation> getAnnotationType () { 22 return annotation.annotationType(); 23 } 24 } 25