Package eworld.computing

Source Code of eworld.computing.TraceAspect

package eworld.computing;

import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
import org.codehaus.aspectwerkz.joinpoint.MemberSignature;

public class TraceAspect
{
    int m_level = 0;
   
    public Object trace(JoinPoint joinPoint) throws Throwable {
        MemberSignature signature = (MemberSignature)joinPoint.getSignature();
        indent();
        System.out.println(
                joinPoint.getType() + "--> " + joinPoint.getTargetClass().getName() + "::" + signature.getName()
        );
        m_level++;
        final Object result = joinPoint.proceed();
        m_level--;
        indent();
        System.out.println(
                joinPoint.getType() + "<-- " + joinPoint.getTargetClass().getName() + "::" + signature.getName()
        );
        return result;
    }

    private void indent() {
        for (int i = 0; i < m_level; i++) {
            System.out.print("  ");
        }
    }
   
}
TOP

Related Classes of eworld.computing.TraceAspect

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.