Class Invocation


  • public final class Invocation
    extends Object
    The class represents a wrapper around XMLStreamWriter invocations.
    Author:
    Marek Potociar (marek.potociar at sun.com)
    • Method Detail

      • createInvocation

        public static Invocation createInvocation​(Method method,
                                                  Object[] args)
        Factory method that creates Invocation instance according to input arguments
        Parameters:
        method - method represented by the Invocation instance returned as a result of this factory method call
        args - invocation arguments to be passed to the method when #executeBatch() method is invoked on the Invocation instance.
        Returns:
        the Invocation instance representing invocation of method defined by value of method argument.
      • executeBatch

        public static void executeBatch​(XMLStreamWriter target,
                                        Queue<Invocation> batch)
                                 throws InvocationProcessingException
        Method executes queue of invocations. All invocations must represent methods with void return type. After succesful invocation of the whole batch, the batch queue is fully consumed and empty.
        Parameters:
        target - {@link http://java.sun.com/javase/6/docs/api/javax/xml/stream/XMLStreamWriter.html|XmlStreamWriter} used for invocation queue execution
        batch - queue of invocations to be executed on the targeted {@link http://java.sun.com/javase/6/docs/api/javax/xml/stream/XMLStreamWriter.html|XmlStreamWriter}. After succesful invocation of the whole batch, the batch queue is fully consumed and empty.
        Throws:
        IllegalAccessException
        IllegalArgumentException
        com.sun.xml.ws.policy.jaxws.xmlstreamwriter.InvocationProcessingException
        InvocationProcessingException
      • getMethodName

        public String getMethodName()
        Returns information about the name of the method represented by this Invocation instance
        Returns:
        method name represented by this Invocation instance
      • getArgument

        public Object getArgument​(int index)
                           throws ArrayIndexOutOfBoundsException
        Returns single invocation argument for this Invocation instance that is stored in the invocation arguments array at position determined by index argument.
        Returns:
        single invocation argument for this Invocation instance at position determined by index argument
        Throws:
        ArrayIndexOutOfBoundsException - if there are no arguments in the array or if the index parameter is out of bounds of invocation arguments array
      • getArgumentsCount

        public int getArgumentsCount()
        Returns information about the number of arguments stored in this Invocation instance
        Returns:
        number of arguments stored in this Invocation instance
      • argsToString

        public String argsToString()
        Method returns String representation of arguments stored in the Invocation instance.
        Returns:
        String representation of arguments stored in the Invocation instance.