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

net.cassite.pure.aop.LoggedWeaver Maven / Gradle / Ivy

The newest version!
package net.cassite.pure.aop;

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

/**
 * Around.
* extends this class to do aop and implements interfaces which you want to introduce * * @param target object type * @author wkgcass * @since 0.1.1 */ public abstract class LoggedWeaver implements Weaver { private static Logger LOGGER = LoggerFactory.getLogger(LoggedWeaver.class); /** * before invoking the method * * @param point aop point */ protected abstract void before(AOPPoint point); /** * after the method returned * * @param point aop point */ protected abstract void after(AOPPoint point); /** * after throwing * * @param point aop point * @throws Throwable possible exceptions */ protected abstract void exception(AOPPoint point) throws Throwable; /** * invoked when destroyed * * @param target target object * @since 0.3.1 */ protected abstract void destroy(T target); public final void doBefore(AOPPoint point) { LOGGER.debug("do [Before] with point [{}]", point); before(point); } public final void doAfter(AOPPoint point) { LOGGER.debug("do [After Return] with point [{}]", point); after(point); LOGGER.debug("[After Return] return value is {}", point.returnValue()); } public final void doException(AOPPoint point) throws Throwable { LOGGER.debug("do [After Exception] with point [{}]", point); exception(point); LOGGER.debug("[After Exception] return value is {}", point.returnValue()); } @Override public final void doDestroy(T target) { LOGGER.debug("do [Destroy] on {}", target); destroy(target); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy