All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.cola.test.BeanMetaUtils Maven / Gradle / Ivy

package com.alibaba.cola.test;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

/**
 * BeanMetaUtils
 *
 * @author Frank Zhang
 * @date 2020-11-17 4:49 PM
 */
public class BeanMetaUtils {
    public static Method findMethod(Class clazz, Class annotationType){
        Method[] allMethods = clazz.getMethods();
        for (Method method : allMethods){
            Annotation[] annotations = method.getAnnotations();
            for(Annotation item : annotations){
                if(item.annotationType().equals(annotationType)){
                    return method;
                }
            }
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy