Class Function


  • class Function
    extends java.lang.Object
    The Function object is used to encapsulated the method that is called when serializing an object. This contains details on the type of method represented and ensures that reflection is not required each time the method is to be invoked.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean contextual
      This is used to determine if the method takes the map.
      private java.lang.reflect.Method method
      This is the method that is to be invoked by the function.
    • Constructor Summary

      Constructors 
      Constructor Description
      Function​(java.lang.reflect.Method method)
      Constructor for the Function object.
      Function​(java.lang.reflect.Method method, boolean contextual)
      Constructor for the Function object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object call​(Context context, java.lang.Object source)
      This method used to invoke the callback method of the provided object.
      • Methods inherited from class java.lang.Object

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

      • method

        private final java.lang.reflect.Method method
        This is the method that is to be invoked by the function.
      • contextual

        private final boolean contextual
        This is used to determine if the method takes the map.
    • Constructor Detail

      • Function

        public Function​(java.lang.reflect.Method method)
        Constructor for the Function object. This is used to create an object that wraps the provided method it ensures that no reflection is required when the method is to be called.
        Parameters:
        method - this is the method that is to be wrapped by this
      • Function

        public Function​(java.lang.reflect.Method method,
                        boolean contextual)
        Constructor for the Function object. This is used to create an object that wraps the provided method it ensures that no reflection is required when the method is to be called.
        Parameters:
        method - this is the method that is to be wrapped by this
        contextual - determines if the method is a contextual one
    • Method Detail

      • call

        public java.lang.Object call​(Context context,
                                     java.lang.Object source)
                              throws java.lang.Exception
        This method used to invoke the callback method of the provided object. This will acquire the session map from the context. If the provided object is not null then this will return null.
        Parameters:
        context - this is the context that contains the session
        source - this is the object to invoke the function on
        Returns:
        this returns the result of the method invocation
        Throws:
        java.lang.Exception