View Javadoc
1   package org.apache.maven.plugins.javadoc.resolver;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.File;
23  import java.util.List;
24  
25  import org.apache.maven.project.MavenProject;
26  import org.apache.maven.project.ProjectBuildingRequest;
27  import org.apache.maven.shared.artifact.filter.resolve.AndFilter;
28  
29  /**
30   * 
31   */
32  public class SourceResolverConfig
33  {
34      private ProjectBuildingRequest buildingRequest;
35  
36      private final MavenProject project;
37  
38      private AndFilter filter;
39  
40      private List<MavenProject> reactorProjects;
41  
42      private final File outputBasedir;
43  
44      private boolean compileSourceIncluded;
45  
46      private boolean testSourceIncluded;
47  
48      /**
49       * @param project {@link MavenProject}
50       * @param buildingRequest {@link ProjectBuildingRequest}
51       * @param outputBasedir The output base directory.
52       */
53      public SourceResolverConfig( final MavenProject project, final ProjectBuildingRequest buildingRequest,
54                                   final File outputBasedir )
55      {
56          this.project = project;
57          this.buildingRequest = buildingRequest;
58          this.outputBasedir = outputBasedir;
59      }
60  
61      /**
62       * @param filter {@link AndFilter}
63       * @return {@link SourceResolverConfig}
64       */
65      public SourceResolverConfig withFilter( final AndFilter filter )
66      {
67          this.filter = filter;
68          return this;
69      }
70  
71      /**
72       * @param reactorProjects The list of reactor projects.
73       * @return {@link SourceResolverConfig}
74       */
75      public SourceResolverConfig withReactorProjects( final List<MavenProject> reactorProjects )
76      {
77          this.reactorProjects = reactorProjects;
78          return this;
79      }
80  
81      /**
82       * @return {@link SourceResolverConfig}
83       */
84      public SourceResolverConfig withCompileSources()
85      {
86          compileSourceIncluded = true;
87          return this;
88      }
89  
90      /**
91       * @return {@link SourceResolverConfig}
92       */
93      public SourceResolverConfig withoutCompileSources()
94      {
95          compileSourceIncluded = false;
96          return this;
97      }
98  
99      /**
100      * @return {@link SourceResolverConfig}
101      */
102     public SourceResolverConfig withTestSources()
103     {
104         testSourceIncluded = true;
105         return this;
106     }
107 
108     /**
109      * @return {@link SourceResolverConfig}
110      */
111     public SourceResolverConfig withoutTestSources()
112     {
113         testSourceIncluded = false;
114         return this;
115     }
116 
117     /**
118      * @return {@link MavenProject}
119      */
120     public MavenProject project()
121     {
122         return project;
123     }
124 
125     /**
126      * @return {@link ProjectBuildingRequest}
127      */
128     public ProjectBuildingRequest getBuildingRequest()
129     {
130         return buildingRequest;
131     }
132 
133     /**
134      * @return {@link AndFilter}
135      */
136     public AndFilter filter()
137     {
138         return filter;
139     }
140 
141     /**
142      * @return list of {@link MavenProject}
143      */
144     public List<MavenProject> reactorProjects()
145     {
146         return reactorProjects;
147     }
148 
149     /**
150      * @return {@link #outputBasedir}
151      */
152     public File outputBasedir()
153     {
154         return outputBasedir;
155     }
156 
157     /**
158      * @return {@link #compileSourceIncluded}
159      */
160     public boolean includeCompileSources()
161     {
162         return compileSourceIncluded;
163     }
164 
165     /**
166      * @return {@link #testSourceIncluded}
167      */
168     public boolean includeTestSources()
169     {
170         return testSourceIncluded;
171     }
172 }