Class ConvertedMap

  • All Implemented Interfaces:, java.lang.reflect.InvocationHandler

    public class ConvertedMap
    extends ConversionHandler
    This class is a general adapter to adapt a map of closures to any Java interface.
    See Also:
    Serialized Form
    • Constructor Summary

      Modifier Constructor Description
      protected ConvertedMap​(java.util.Map closures)
      to create a ConvertedMap object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean checkMethod​(java.lang.reflect.Method method)  
      java.lang.Object invokeCustom​(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
      This method is called for all Methods not defined on Object.
      static boolean isCoreObjectMethod​(java.lang.reflect.Method method)
      Checks whether a method is a core method from java.lang.Object.
      java.lang.String toString()
      Returns a String version of the delegate.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ConvertedMap

        protected ConvertedMap​(java.util.Map closures)
        to create a ConvertedMap object.
        closures - the map of closures
    • Method Detail

      • invokeCustom

        public java.lang.Object invokeCustom​(java.lang.Object proxy,
                                             java.lang.reflect.Method method,
                                             java.lang.Object[] args)
                                      throws java.lang.Throwable
        Description copied from class: ConversionHandler
        This method is called for all Methods not defined on Object. The delegate should be called here.
        Specified by:
        invokeCustom in class ConversionHandler
        proxy - the proxy
        method - the method
        args - the arguments
        the result of the invocation of the delegate
        java.lang.Throwable - any exception causes by the delegate
        See Also:
        ConversionHandler.invoke(Object, Method, Object[]), InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
      • toString

        public java.lang.String toString()
        Description copied from class: ConversionHandler
        Returns a String version of the delegate.
        toString in class ConversionHandler
        See Also:
      • isCoreObjectMethod

        public static boolean isCoreObjectMethod​(java.lang.reflect.Method method)
        Checks whether a method is a core method from java.lang.Object. Such methods often receive special treatment because they are deemed fundamental enough to not be tampered with. call toString() is an exception to allow overriding toString() by a closure specified in the map
        method - the method to check
        true if the method is deemed to be a core method