Package ej.kf

Class Proxy<T>

  • Type Parameters:
    T - the type managed by this Proxy

    public class Proxy<T>
    extends Object
    The superclass of proxy classes. A proxy class is a class that directly extends this class and directly implements a shared interface. Each method of the implemented interface must be defined according to the following pattern:
     public class MyProxy extends Proxy<MySharedInterface> implements MySharedInterface{
            public void foo(){
                    try{
                            invoke();
                    }
                    catch(Throwable e){
                            // return or throw default case (deny of service)
                    }
            }
     
    A Proxy instance has a link to a reference owned by another Feature. The reference may be automatically removed by the garbage collector.
    • Constructor Summary

      Constructors 
      Constructor Description
      Proxy()
      The default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T getReference()
      Returns the reference managed by this Proxy.
      protected void invoke()
      This method has for effect to invoke the same method on the reference.
      protected boolean invokeBoolean()
      This method has for effect to invoke the same method on the reference.
      protected byte invokeByte()
      This method has for effect to invoke the same method on the reference.
      protected char invokeChar()
      This method has for effect to invoke the same method on the reference.
      protected double invokeDouble()
      This method has for effect to invoke the same method on the reference.
      protected float invokeFloat()
      This method has for effect to invoke the same method on the reference.
      protected int invokeInt()
      This method has for effect to invoke the same method on the reference.
      protected long invokeLong()
      This method has for effect to invoke the same method on the reference.
      protected Object invokeRef()
      This method has for effect to invoke the same method on the reference.
      protected short invokeShort()
      This method has for effect to invoke the same method on the reference.
    • Constructor Detail

      • Proxy

        public Proxy()
        The default constructor.
    • Method Detail

      • invoke

        protected final void invoke()
                             throws Throwable
        This method has for effect to invoke the same method on the reference. Each argument of the current method is converted and passed to the underlying method.
        Throws:
        Throwable - any kind of exceptions must be catched by the caller
      • invokeBoolean

        protected final boolean invokeBoolean()
                                       throws Throwable
        This method has for effect to invoke the same method on the reference. Each argument of the current method is converted and passed to the underlying method.
        Returns:
        the boolean result of the call of the target method
        Throws:
        Throwable - any kind of exceptions must be catched by the caller
      • invokeByte

        protected final byte invokeByte()
                                 throws Throwable
        This method has for effect to invoke the same method on the reference. Each argument of the current method is converted and passed to the underlying method.
        Returns:
        the byte result of the call of the target method
        Throws:
        Throwable - any kind of exceptions must be catched by the caller
      • invokeChar

        protected final char invokeChar()
                                 throws Throwable
        This method has for effect to invoke the same method on the reference. Each argument of the current method is converted and passed to the underlying method.
        Returns:
        the char result of the call of the target method
        Throws:
        Throwable - any kind of exceptions must be catched by the caller
      • invokeShort

        protected final short invokeShort()
                                   throws Throwable
        This method has for effect to invoke the same method on the reference. Each argument of the current method is converted and passed to the underlying method.
        Returns:
        the short result of the call of the target method
        Throws:
        Throwable - any kind of exceptions must be catched by the caller
      • invokeInt

        protected final int invokeInt()
                               throws Throwable
        This method has for effect to invoke the same method on the reference. Each argument of the current method is converted and passed to the underlying method.
        Returns:
        the int result of the call of the target method
        Throws:
        Throwable - any kind of exceptions must be catched by the caller
      • invokeLong

        protected final long invokeLong()
                                 throws Throwable
        This method has for effect to invoke the same method on the reference. Each argument of the current method is converted and passed to the underlying method.
        Returns:
        the long result of the call of the target method
        Throws:
        Throwable - any kind of exceptions must be catched by the caller
      • invokeFloat

        protected final float invokeFloat()
                                   throws Throwable
        This method has for effect to invoke the same method on the reference. Each argument of the current method is converted and passed to the underlying method.
        Returns:
        the float result of the call of the target method
        Throws:
        Throwable - any kind of exceptions must be catched by the caller
      • invokeDouble

        protected final double invokeDouble()
                                     throws Throwable
        This method has for effect to invoke the same method on the reference. Each argument of the current method is converted and passed to the underlying method.
        Returns:
        the double result of the call of the target method
        Throws:
        Throwable - any kind of exceptions must be catched by the caller
      • invokeRef

        protected final Object invokeRef()
                                  throws Throwable
        This method has for effect to invoke the same method on the reference. Each argument of the current method is converted and passed to the underlying method.
        Returns:
        the Object result of the call of the target method
        Throws:
        Throwable - any kind of exceptions must be catched by the caller
      • getReference

        @Nullable
        public T getReference()
        Returns the reference managed by this Proxy.
        Returns:
        the reference or null if the reference has been reclaimed.