View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.model.io;
20  
21  import java.io.File;
22  import java.io.IOException;
23  import java.io.OutputStream;
24  import java.io.Writer;
25  import java.util.Map;
26  
27  import org.apache.maven.api.model.Model;
28  
29  /**
30   * Handles serialization of a model into some kind of textual format like XML.
31   *
32   * @deprecated use {@link org.apache.maven.api.services.xml.ModelXmlFactory} instead
33   */
34  @Deprecated(since = "4.0.0")
35  public interface ModelWriter {
36  
37      /**
38       * Writes the supplied model to the specified file. Any non-existing parent directories of the output file will be
39       * created automatically.
40       *
41       * @param output The file to serialize the model to, must not be {@code null}.
42       * @param options The options to use for serialization, may be {@code null} to use the default values.
43       * @param model The model to serialize, must not be {@code null}.
44       * @throws IOException If the model could not be serialized.
45       */
46      void write(File output, Map<String, Object> options, Model model) throws IOException;
47  
48      /**
49       * Writes the supplied model to the specified character writer. The writer will be automatically closed before the
50       * method returns.
51       *
52       * @param output The writer to serialize the model to, must not be {@code null}.
53       * @param options The options to use for serialization, may be {@code null} to use the default values.
54       * @param model The model to serialize, must not be {@code null}.
55       * @throws IOException If the model could not be serialized.
56       */
57      void write(Writer output, Map<String, Object> options, Model model) throws IOException;
58  
59      /**
60       * Writes the supplied model to the specified byte stream. The stream will be automatically closed before the method
61       * returns.
62       *
63       * @param output The stream to serialize the model to, must not be {@code null}.
64       * @param options The options to use for serialization, may be {@code null} to use the default values.
65       * @param model The model to serialize, must not be {@code null}.
66       * @throws IOException If the model could not be serialized.
67       */
68      void write(OutputStream output, Map<String, Object> options, Model model) throws IOException;
69  
70      /**
71       * Writes the supplied model to the specified file. Any non-existing parent directories of the output file will be
72       * created automatically.
73       *
74       * @param output The file to serialize the model to, must not be {@code null}.
75       * @param options The options to use for serialization, may be {@code null} to use the default values.
76       * @param model The model to serialize, must not be {@code null}.
77       * @throws IOException If the model could not be serialized.
78       */
79      void write(File output, Map<String, Object> options, org.apache.maven.model.Model model) throws IOException;
80  
81      /**
82       * Writes the supplied model to the specified character writer. The writer will be automatically closed before the
83       * method returns.
84       *
85       * @param output The writer to serialize the model to, must not be {@code null}.
86       * @param options The options to use for serialization, may be {@code null} to use the default values.
87       * @param model The model to serialize, must not be {@code null}.
88       * @throws IOException If the model could not be serialized.
89       */
90      void write(Writer output, Map<String, Object> options, org.apache.maven.model.Model model) throws IOException;
91  
92      /**
93       * Writes the supplied model to the specified byte stream. The stream will be automatically closed before the method
94       * returns.
95       *
96       * @param output The stream to serialize the model to, must not be {@code null}.
97       * @param options The options to use for serialization, may be {@code null} to use the default values.
98       * @param model The model to serialize, must not be {@code null}.
99       * @throws IOException If the model could not be serialized.
100      */
101     void write(OutputStream output, Map<String, Object> options, org.apache.maven.model.Model model) throws IOException;
102 }