Java Reflection Annotation getAnnotationClass(Annotation annotation)

Here you can find the source of getAnnotationClass(Annotation annotation)

Description

Resolve the impl's class.

License

Open Source License

Parameter

Parameter Description
annotation the impl

Return

the class object of the impl.

Declaration

public static Class<? extends Annotation> getAnnotationClass(Annotation annotation) 

Method Source Code


//package com.java2s;
/*//from w  w w.j a  v a  2  s .  c o m
 * dataZ - Test Support For Data Stores.
 *
 * Copyright 2014-2017 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v10.html
 */

import java.lang.annotation.Annotation;

public class Main {
    /**
     * Resolve the impl's class.
     *
     * @param annotation the impl
     *
     * @return the class object of the impl.
     */
    public static Class<? extends Annotation> getAnnotationClass(Annotation annotation) {
        return annotation.annotationType();
    }
}

Related

  1. getAnnotationAttributes(final Annotation annotation)
  2. getAnnotationAttributeValue(final Annotation annotation, final String attributeName)
  3. getAnnotationByType(AnnotatedElement element, Class annotationType)
  4. getAnnotationByType(List annotations, Class annotationType)
  5. getAnnotationClass(Annotation a)
  6. getAnnotationClass(Class clazz, Class annotation)
  7. getAnnotationClass(Class entityClass, Class annotationClass)
  8. getAnnotationClass(String name)
  9. getAnnotationDeep(Annotation from, Class toFind)