View Javadoc

1   /*
2    * Copyright 2005-2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.ws.stream;
18  
19  import javax.xml.namespace.QName;
20  import javax.xml.stream.XMLStreamException;
21  import javax.xml.stream.XMLStreamWriter;
22  
23  /**
24   * Defines the contract for payloads that can be written directly to a {@link XMLStreamWriter}.
25   *
26   * @author Arjen Poutsma
27   * @see StreamingWebServiceMessage
28   * @since 2.0
29   */
30  public interface StreamingPayload {
31  
32      /**
33       * Returns the qualified name of the payload.
34       *
35       * @return the qualified name
36       */
37      QName getName();
38  
39      /**
40       * Writes this payload to the given {@link XMLStreamWriter}.
41       *
42       * @param streamWriter the stream writer to write to
43       * @throws XMLStreamException in case of errors
44       */
45      void writeTo(XMLStreamWriter streamWriter) throws XMLStreamException;
46  
47  }