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

com.silentgo.core.aop.MethodParam Maven / Gradle / Ivy

There is a newer version: 0.0.49
Show newest version
package com.silentgo.core.aop;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;

/**
 * Project : silentgo
 * com.silentgo.core
 *
 * @author teddyzhu
 *         

* Created by teddyzhu on 16/7/27. */ public class MethodParam { public static final Logger LOGGER = LoggerFactory.getLogger(MethodParam.class); private Class type; private String name; private List> anTypes; private List annotations; public Class getType() { return type; } public String getName() { return name; } public MethodParam(Class type, String name, List annotations) { this.type = type; this.name = name; this.annotations = annotations; anTypes = new ArrayList<>(); annotations.forEach(annotation -> anTypes.add(annotation.annotationType())); } public boolean existAnnotation(Class clz) { return anTypes.contains(clz); } public T getAnnotation(Class tClass) { for (Annotation annotation : annotations) { if (annotation.annotationType().equals(tClass)) { return (T) annotation; } } return null; } public List getAnnotations() { return annotations; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy