![JAR search and dependency download from the Maven repository](/logo.png)
com.g2forge.alexandria.java.annotation.SimpleAnnotatedElement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ax-java Show documentation
Show all versions of ax-java Show documentation
Standard Java library and the basis of the ${alexandria.name} project.
package com.g2forge.alexandria.java.annotation;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.util.Arrays;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class SimpleAnnotatedElement implements AnnotatedElement {
protected final Annotation[] annotations;
@SuppressWarnings("unchecked")
@Override
public T getAnnotation(Class annotationClass) {
for (Annotation element : annotations) {
if (annotationClass.isInstance(element)) return (T) element;
}
return null;
}
@Override
public Annotation[] getAnnotations() {
return Arrays.copyOf(annotations, annotations.length);
}
@Override
public Annotation[] getDeclaredAnnotations() {
return getAnnotations();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy