com.silentgo.core.aop.MethodParam Maven / Gradle / Ivy
package com.silentgo.core.aop;
import com.silentgo.utils.log.Log;
import com.silentgo.utils.log.LogFactory;
import com.silentgo.utils.reflect.SGParameter;
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 {
private static final Log LOGGER = LogFactory.get();
SGParameter sgParameter;
private List annotations;
public Class> getType() {
return sgParameter.getClz();
}
public String getName() {
return sgParameter.getName();
}
public MethodParam(SGParameter sgParameter) {
this.sgParameter = sgParameter;
this.annotations = new ArrayList<>(sgParameter.getAnnotationMap().values());
}
public boolean existAnnotation(Class extends Annotation> clz) {
return sgParameter.getAnnotationMap().containsKey(clz);
}
public T getAnnotation(Class tClass) {
return (T) sgParameter.getAnnotationMap().get(tClass);
}
public List getAnnotations() {
return annotations;
}
}