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.plugins.javadoc.resolver;
20
21 import java.io.File;
22 import java.util.List;
23
24 import org.apache.maven.project.MavenProject;
25 import org.apache.maven.project.ProjectBuildingRequest;
26 import org.apache.maven.shared.artifact.filter.resolve.AndFilter;
27
28 /**
29 *
30 */
31 public class SourceResolverConfig {
32 private ProjectBuildingRequest buildingRequest;
33
34 private final MavenProject project;
35
36 private AndFilter filter;
37
38 private List<MavenProject> reactorProjects;
39
40 private final File outputBasedir;
41
42 private boolean compileSourceIncluded;
43
44 private boolean testSourceIncluded;
45
46 /**
47 * @param project {@link MavenProject}
48 * @param buildingRequest {@link ProjectBuildingRequest}
49 * @param outputBasedir The output base directory.
50 */
51 public SourceResolverConfig(
52 final MavenProject project, final ProjectBuildingRequest buildingRequest, final File outputBasedir) {
53 this.project = project;
54 this.buildingRequest = buildingRequest;
55 this.outputBasedir = outputBasedir;
56 }
57
58 /**
59 * @param filter {@link AndFilter}
60 * @return {@link SourceResolverConfig}
61 */
62 public SourceResolverConfig withFilter(final AndFilter filter) {
63 this.filter = filter;
64 return this;
65 }
66
67 /**
68 * @param reactorProjects The list of reactor projects.
69 * @return {@link SourceResolverConfig}
70 */
71 public SourceResolverConfig withReactorProjects(final List<MavenProject> reactorProjects) {
72 this.reactorProjects = reactorProjects;
73 return this;
74 }
75
76 /**
77 * @return {@link SourceResolverConfig}
78 */
79 public SourceResolverConfig withCompileSources() {
80 compileSourceIncluded = true;
81 return this;
82 }
83
84 /**
85 * @return {@link SourceResolverConfig}
86 */
87 public SourceResolverConfig withoutCompileSources() {
88 compileSourceIncluded = false;
89 return this;
90 }
91
92 /**
93 * @return {@link SourceResolverConfig}
94 */
95 public SourceResolverConfig withTestSources() {
96 testSourceIncluded = true;
97 return this;
98 }
99
100 /**
101 * @return {@link SourceResolverConfig}
102 */
103 public SourceResolverConfig withoutTestSources() {
104 testSourceIncluded = false;
105 return this;
106 }
107
108 /**
109 * @return {@link MavenProject}
110 */
111 public MavenProject project() {
112 return project;
113 }
114
115 /**
116 * @return {@link ProjectBuildingRequest}
117 */
118 public ProjectBuildingRequest getBuildingRequest() {
119 return buildingRequest;
120 }
121
122 /**
123 * @return {@link AndFilter}
124 */
125 public AndFilter filter() {
126 return filter;
127 }
128
129 /**
130 * @return list of {@link MavenProject}
131 */
132 public List<MavenProject> reactorProjects() {
133 return reactorProjects;
134 }
135
136 /**
137 * @return {@link #outputBasedir}
138 */
139 public File outputBasedir() {
140 return outputBasedir;
141 }
142
143 /**
144 * @return {@link #compileSourceIncluded}
145 */
146 public boolean includeCompileSources() {
147 return compileSourceIncluded;
148 }
149
150 /**
151 * @return {@link #testSourceIncluded}
152 */
153 public boolean includeTestSources() {
154 return testSourceIncluded;
155 }
156 }