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

uncle.aspect.ControllerAspect Maven / Gradle / Ivy

The newest version!
package uncle.aspect;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uncle.annotation.Aspect;
import uncle.annotation.UncleController;
import uncle.proxy.AspectProxy;

import java.lang.reflect.Method;

/**
 * Created by hujianbo on 2018/1/19.
 */
@Aspect(UncleController.class)
public class ControllerAspect extends AspectProxy {
    private static final Logger LOGGER = LoggerFactory.getLogger(ControllerAspect.class);
    private long begin;

    @Override
    public void before(Class cls, Method method, Object[] params) {
        LOGGER.debug("------------begin--------------");
        LOGGER.debug(String.format("class: %s", cls.getName()));
        LOGGER.debug(String.format("method: %s", method.getName()));
        begin = System.currentTimeMillis();
    }

    @Override
    public void after(Class cls, Method method, Object[] params) {
        LOGGER.debug(String.format("time: %s", System.currentTimeMillis() - begin));
        LOGGER.debug("------------end--------------");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy