Class SampleAdvice1

java.lang.Object
info.ejava.examples.svc.aop.items.proxyfactory.SampleAdvice1
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.springframework.aop.AfterAdvice, org.springframework.aop.AfterReturningAdvice, org.springframework.aop.BeforeAdvice, org.springframework.aop.MethodBeforeAdvice

public class SampleAdvice1 extends Object implements org.springframework.aop.MethodBeforeAdvice, org.springframework.aop.AfterReturningAdvice
This class provides programmatic advice definitions that can be assigned using a ProxyFactory
     ProxyFactory proxyFactory = new ProxyFactory(mowerService);
     proxyFactory.addAdvice(new SampleAdvice1());
     ItemsService proxiedMowerService = (ItemsService) proxyFactory.getProxy();
     proxiedMowerService.createItem(mower2);
 
  • Constructor Details

    • SampleAdvice1

      public SampleAdvice1()
  • Method Details

    • before

      public void before(Method method, Object[] args, Object target) throws Throwable
      Specified by:
      before in interface org.springframework.aop.MethodBeforeAdvice
      Throws:
      Throwable
    • afterReturning

      public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable
      Specified by:
      afterReturning in interface org.springframework.aop.AfterReturningAdvice
      Throws:
      Throwable