org.springframework.remoting.support

Class RemoteInvocation

  • java.lang.Object
    • org.springframework.remoting.support.RemoteInvocation
    • Constructor Summary

      Constructors 
      Constructor and Description
      RemoteInvocation()
      Create a new RemoteInvocation for JavaBean-style deserialization (e.g.
      RemoteInvocation(MethodInvocation methodInvocation)
      Create a new RemoteInvocation for the given AOP method invocation.
      RemoteInvocation(java.lang.String methodName, java.lang.Class<?>[] parameterTypes, java.lang.Object[] arguments)
      Create a new RemoteInvocation for the given parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addAttribute(java.lang.String key, java.io.Serializable value)
      Add an additional invocation attribute.
      java.lang.Object[] getArguments()
      Return the arguments for the target method call.
      java.io.Serializable getAttribute(java.lang.String key)
      Retrieve the attribute for the given key, if any.
      java.util.Map<java.lang.String,java.io.Serializable> getAttributes()
      Return the attributes Map.
      java.lang.String getMethodName()
      Return the name of the target method.
      java.lang.Class<?>[] getParameterTypes()
      Return the parameter types of the target method.
      java.lang.Object invoke(java.lang.Object targetObject)
      Perform this invocation on the given target object.
      void setArguments(java.lang.Object[] arguments)
      Set the arguments for the target method call.
      void setAttributes(java.util.Map<java.lang.String,java.io.Serializable> attributes)
      Set the attributes Map.
      void setMethodName(java.lang.String methodName)
      Set the name of the target method.
      void setParameterTypes(java.lang.Class<?>[] parameterTypes)
      Set the parameter types of the target method.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

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

      • RemoteInvocation

        public RemoteInvocation(MethodInvocation methodInvocation)
        Create a new RemoteInvocation for the given AOP method invocation.
        Parameters:
        methodInvocation - the AOP invocation to convert
      • RemoteInvocation

        public RemoteInvocation(java.lang.String methodName,
                                java.lang.Class<?>[] parameterTypes,
                                java.lang.Object[] arguments)
        Create a new RemoteInvocation for the given parameters.
        Parameters:
        methodName - the name of the method to invoke
        parameterTypes - the parameter types of the method
        arguments - the arguments for the invocation
      • RemoteInvocation

        public RemoteInvocation()
        Create a new RemoteInvocation for JavaBean-style deserialization (e.g. with Jackson).
    • Method Detail

      • setMethodName

        public void setMethodName(java.lang.String methodName)
        Set the name of the target method.

        This setter is intended for JavaBean-style deserialization.

      • getMethodName

        public java.lang.String getMethodName()
        Return the name of the target method.
      • setParameterTypes

        public void setParameterTypes(java.lang.Class<?>[] parameterTypes)
        Set the parameter types of the target method.

        This setter is intended for JavaBean-style deserialization.

      • getParameterTypes

        public java.lang.Class<?>[] getParameterTypes()
        Return the parameter types of the target method.
      • setArguments

        public void setArguments(java.lang.Object[] arguments)
        Set the arguments for the target method call.

        This setter is intended for JavaBean-style deserialization.

      • getArguments

        public java.lang.Object[] getArguments()
        Return the arguments for the target method call.
      • addAttribute

        public void addAttribute(java.lang.String key,
                                 java.io.Serializable value)
                          throws java.lang.IllegalStateException
        Add an additional invocation attribute. Useful to add additional invocation context without having to subclass RemoteInvocation.

        Attribute keys have to be unique, and no overriding of existing attributes is allowed.

        The implementation avoids to unnecessarily create the attributes Map, to minimize serialization size.

        Parameters:
        key - the attribute key
        value - the attribute value
        Throws:
        java.lang.IllegalStateException - if the key is already bound
      • getAttribute

        @Nullable
        public java.io.Serializable getAttribute(java.lang.String key)
        Retrieve the attribute for the given key, if any.

        The implementation avoids to unnecessarily create the attributes Map, to minimize serialization size.

        Parameters:
        key - the attribute key
        Returns:
        the attribute value, or null if not defined
      • invoke

        public java.lang.Object invoke(java.lang.Object targetObject)
                                throws java.lang.NoSuchMethodException,
                                       java.lang.IllegalAccessException,
                                       java.lang.reflect.InvocationTargetException
        Perform this invocation on the given target object. Typically called when a RemoteInvocation is received on the server.
        Parameters:
        targetObject - the target object to apply the invocation to
        Returns:
        the invocation result
        Throws:
        java.lang.NoSuchMethodException - if the method name could not be resolved
        java.lang.IllegalAccessException - if the method could not be accessed
        java.lang.reflect.InvocationTargetException - if the method invocation resulted in an exception
        See Also:
        Method.invoke(java.lang.Object, java.lang.Object...)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object