package com.example;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;

@Aspect
public class ShipAdvice {

    @Pointcut("call(void com.example.Ship.updatePosition(*))")
    public void updatePositionPointcut() {
    }

    @Around("updatePositionPointcut()")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("Calling " + pjp.getSignature().getName());
        Object methodResult = pjp.proceed();
        System.out.println("After " + pjp.getSignature().getName());
        return methodResult;
    }
}
