Class Parameters.ParametersIfcInvocationHandler

  • All Implemented Interfaces:
    java.lang.reflect.InvocationHandler
    Enclosing class:
    Parameters

    private static final class Parameters.ParametersIfcInvocationHandler
    extends java.lang.Object
    implements java.lang.reflect.InvocationHandler
    A specialized InvocationHandler implementation which maps the methods of a parameters interface to an implementation of the corresponding property interfaces. The parameters interface is a union of multiple property interfaces. The wrapped object implements all of these, but not the union interface. Therefore, a reflection-based approach is required. A special handling is required for the method of the BuilderParameters interface because here no fluent return value is used.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Object target
      The target object of reflection calls.
    • Constructor Summary

      Constructors 
      Constructor Description
      ParametersIfcInvocationHandler​(java.lang.Object targetObj)
      Creates a new instance of ParametersIfcInvocationHandler and sets the wrapped parameters object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object invoke​(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
      This implementation delegates method invocations to the target object and handles the return value correctly.
      private static boolean isFluentResult​(java.lang.reflect.Method method)
      Checks whether the specified method belongs to an interface which requires fluent result values.
      • Methods inherited from class java.lang.Object

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

      • target

        private final java.lang.Object target
        The target object of reflection calls.
    • Constructor Detail

      • ParametersIfcInvocationHandler

        public ParametersIfcInvocationHandler​(java.lang.Object targetObj)
        Creates a new instance of ParametersIfcInvocationHandler and sets the wrapped parameters object.
        Parameters:
        targetObj - the target object for reflection calls
    • Method Detail

      • isFluentResult

        private static boolean isFluentResult​(java.lang.reflect.Method method)
        Checks whether the specified method belongs to an interface which requires fluent result values.
        Parameters:
        method - the method to be checked
        Returns:
        a flag whether the method's result should be handled as a fluent result value
      • invoke

        public java.lang.Object invoke​(java.lang.Object proxy,
                                       java.lang.reflect.Method method,
                                       java.lang.Object[] args)
                                throws java.lang.Throwable
        This implementation delegates method invocations to the target object and handles the return value correctly.
        Specified by:
        invoke in interface java.lang.reflect.InvocationHandler
        Throws:
        java.lang.Throwable