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

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

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

import com.silentgo.utils.reflect.SGMethod;
import com.silentgo.utils.reflect.SGParameter;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * Project : silentgo
 * com.silentgo.core.aop
 * 

*

* * @author teddyzhu * Created by teddyzhu on 16/7/27. */ public class MethodAdviser { private SGMethod sgMethod; private MethodParam[] params; private List annotations = new ArrayList<>(); public String getMethodName() { return sgMethod.getFullName(); } public Method getName() { return sgMethod.getMethod(); } public MethodParam[] getParams() { return params; } public MethodAdviser(SGMethod sgMethod) { this.sgMethod = sgMethod; this.params = new MethodParam[sgMethod.getParameterNames().length]; for (int i = 0; i < sgMethod.getParameterNames().length; i++) { this.params[i] = new MethodParam(sgMethod.getParameterMap().get(sgMethod.getParameterNames()[i])); } this.annotations = new ArrayList<>(sgMethod.getAnnotationMap().values()); } public String getClassName() { return sgMethod.getClassName(); } public List getAnnotations() { return annotations; } public boolean existAnnotation(Class clz) { return sgMethod.getAnnotationMap().containsKey(clz); } @SuppressWarnings("unchecked") public T getAnnotation(Class tClass) { return (T) sgMethod.getAnnotationMap().get(tClass); } public Method getMethod() { return sgMethod.getMethod(); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy