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.shared.filtering;
20  
21  import java.io.Reader;
22  import java.util.List;
23  import java.util.Properties;
24  
25  import org.apache.maven.execution.MavenSession;
26  import org.apache.maven.project.MavenProject;
27  
28  /**
29   * @author Olivier Lamy
30   * @author Kristian Rosenvold
31   * @since 1.0-beta-3
32   */
33  public class MavenReaderFilterRequest extends AbstractMavenFilteringRequest {
34  
35      private Reader from;
36  
37      private boolean filtering;
38  
39      /**
40       * Default constructor.
41       */
42      public MavenReaderFilterRequest() {
43          // nothing
44      }
45  
46      /**
47       * @param from To read from
48       * @param filtering filter yes/no
49       * @param mavenProject The Maven Project.
50       * @param filters The list of filters which will be used.
51       * @param escapedBackslashesInFilePath escape backslashes in file paths.
52       * @param mavenSession The Maven Session.
53       * @param additionalProperties supplemental properties.
54       */
55      public MavenReaderFilterRequest(
56              Reader from,
57              boolean filtering,
58              MavenProject mavenProject,
59              List<String> filters,
60              boolean escapedBackslashesInFilePath,
61              MavenSession mavenSession,
62              Properties additionalProperties) {
63          super(mavenProject, filters, mavenSession);
64          this.from = from;
65          this.filtering = filtering;
66          setAdditionalProperties(additionalProperties);
67          setEscapeWindowsPaths(escapedBackslashesInFilePath);
68      }
69  
70      /**
71       * @return where we read from.
72       */
73      public Reader getFrom() {
74          return from;
75      }
76  
77      /**
78       * @param from set where to read from.
79       */
80      public void setFrom(Reader from) {
81          this.from = from;
82      }
83  
84      /**
85       * @return is filtering active ({@code true}) false otherwise.
86       */
87      public boolean isFiltering() {
88          return filtering;
89      }
90  
91      /**
92       * @param filtering turn filtering on {@code true}) or off ({@code false}).
93       */
94      public void setFiltering(boolean filtering) {
95          this.filtering = filtering;
96      }
97  }