Class DelegateAdvice

  • All Implemented Interfaces:
    ProxyAdvice

    public class DelegateAdvice
    extends java.lang.Object
    implements ProxyAdvice
    Delegates calls to target using reflection. Offers separation between between points where class is loaded and class is used.

    Allows usage of classes loaded by different class loader. For example, if you have an instance of class loaded by parent-last class loader, delegate allows to still call it using plain java. Under the hood, each method will actually invoke target method using reflection.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.Object _target
      Target object.
    • Constructor Summary

      Constructors 
      Constructor Description
      DelegateAdvice()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object execute()
      Looks up for method in target object and invokes it using reflection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • _target

        public java.lang.Object _target
        Target object.
    • Constructor Detail

      • DelegateAdvice

        public DelegateAdvice()
    • Method Detail

      • execute

        public java.lang.Object execute()
                                 throws java.lang.Exception
        Looks up for method in target object and invokes it using reflection.
        Specified by:
        execute in interface ProxyAdvice
        Throws:
        java.lang.Exception