Java Reflection Annotation getAnnotationDefaultMap(Class annotationClass)

Here you can find the source of getAnnotationDefaultMap(Class annotationClass)

Description

get Annotation Default Map

License

Apache License

Declaration

public static <T extends Annotation> Map<String, Object> getAnnotationDefaultMap(Class<T> annotationClass) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.lang.annotation.Annotation;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    public static <T extends Annotation> Map<String, Object> getAnnotationDefaultMap(Class<T> annotationClass) {
        return Stream.of(annotationClass.getDeclaredMethods()).filter(m -> m.getDefaultValue() != null)
                .collect(Collectors.toMap(m -> m.getName(), m -> m.getDefaultValue()));
    }//  ww  w . j  a va2 s  .c  o m
}

Related

  1. getAnnotationClass(Class clazz, Class annotation)
  2. getAnnotationClass(Class entityClass, Class annotationClass)
  3. getAnnotationClass(String name)
  4. getAnnotationDeep(Annotation from, Class toFind)
  5. getAnnotationDefault(Class annotationClass, String element)
  6. getAnnotationElementValue(AnnotatedElement annotatedElement, String annotationClassName, String annotationElementName, Class annotationElementType)
  7. getAnnotationField(Annotation annotation, String field)
  8. getAnnotationFields(Class claz, Class annotationType)
  9. getAnnotationFields(Class clazz, Class annotationClass)