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.xpp3;
20  
21  import java.io.IOException;
22  import java.io.InputStream;
23  import java.io.Reader;
24  
25  import org.apache.maven.model.InputSource;
26  import org.apache.maven.model.Model;
27  import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
28  
29  /**
30   * @deprecated Use MavenStaxReader instead
31   */
32  @Deprecated
33  public class MavenXpp3ReaderEx extends MavenXpp3Reader {
34  
35      public MavenXpp3ReaderEx() {
36          this(null);
37      }
38  
39      public MavenXpp3ReaderEx(ContentTransformer contentTransformer) {
40          super(contentTransformer != null ? contentTransformer::transform : null, true);
41      }
42  
43      @Override
44      public Model read(Reader reader, boolean strict, InputSource source) throws IOException, XmlPullParserException {
45          return super.read(reader, strict, source);
46      }
47  
48      @Override
49      public Model read(Reader reader, boolean strict) throws IOException, XmlPullParserException {
50          return super.read(reader, strict);
51      }
52  
53      @Override
54      public Model read(Reader reader) throws IOException, XmlPullParserException {
55          return super.read(reader);
56      }
57  
58      @Override
59      public Model read(InputStream in, boolean strict, InputSource source) throws IOException, XmlPullParserException {
60          return super.read(in, strict, source);
61      }
62  
63      @Override
64      public Model read(InputStream in, boolean strict) throws IOException, XmlPullParserException {
65          return super.read(in, strict);
66      }
67  
68      @Override
69      public Model read(InputStream in) throws IOException, XmlPullParserException {
70          return super.read(in);
71      }
72  
73      public interface ContentTransformer {
74          /**
75           * Interpolate the value read from the xpp3 document
76           *
77           * @param source    the source value
78           * @param fieldName a description of the field being interpolated. The implementation may use this to
79           *                  log stuff
80           * @return the interpolated value
81           */
82          String transform(String source, String fieldName);
83      }
84  }