Class JavassistAspectPlugin

java.lang.Object
io.vertigo.core.plugins.component.aop.javassist.JavassistAspectPlugin
All Implemented Interfaces:
AspectPlugin, CoreComponent, Plugin

public final class JavassistAspectPlugin extends Object implements AspectPlugin
This class implements the aspects using the javassist library.
Author:
pchretien
  • Constructor Details

    • JavassistAspectPlugin

      public JavassistAspectPlugin()
  • Method Details

    • wrap

      public <C extends CoreComponent> C wrap(C instance, Map<Method,List<Aspect>> joinPoints)
      Creates a proxy reference for a component instance, applying the specified aspects at defined join points. The proxy wraps the provided component instance, intercepting method calls as defined by the join points and their associated aspects. This enables the implementation of cross-cutting concerns such as logging, security, or performance monitoring.
      Specified by:
      wrap in interface AspectPlugin
      Type Parameters:
      C - the type of the component, which must extend CoreComponent
      Parameters:
      instance - the component instance to be wrapped by the proxy
      joinPoints - a map associating methods to lists of Aspect objects defining the interception logic
      Returns:
      a proxy reference implementing the same interface as the provided component instance
    • unwrap

      public <C extends CoreComponent> C unwrap(C component)
      Description copied from interface: AspectPlugin
      Retrieves the original component instance from a proxy reference. This method unwraps the proxy to return the underlying component instance, removing any aspect-related interception logic. If the provided component is not a proxy, the original instance is returned unchanged.
      Specified by:
      unwrap in interface AspectPlugin
      Type Parameters:
      C - the type of the component, which must extend CoreComponent
      Parameters:
      component - the proxy or component instance to unwrap
      Returns:
      the underlying component instance