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.building;
20  
21  import java.util.Objects;
22  
23  import org.apache.maven.model.InputLocation;
24  import org.apache.maven.model.building.ModelProblem.Severity;
25  import org.apache.maven.model.building.ModelProblem.Version;
26  
27  /**
28   * Class to wrap request parameters to ModelProblemCollector.addProblem
29   *
30   * @deprecated use {@link org.apache.maven.api.services.ModelBuilder} instead
31   */
32  @Deprecated(since = "4.0.0")
33  public final class ModelProblemCollectorRequest {
34  
35      private final ModelProblem.Severity severity;
36      private final ModelProblem.Version version;
37      private Exception exception;
38      private String message;
39      private InputLocation location;
40  
41      /**
42       * Create a new request with mandatory parameters.
43       * @param severity
44       * @param version
45       */
46      public ModelProblemCollectorRequest(Severity severity, Version version) {
47          this.severity = Objects.requireNonNull(severity, "severity cannot be null");
48          this.version = Objects.requireNonNull(version, "version cannot be null");
49      }
50  
51      public Severity getSeverity() {
52          return severity;
53      }
54  
55      public Version getVersion() {
56          return version;
57      }
58  
59      public Exception getException() {
60          return exception;
61      }
62  
63      public ModelProblemCollectorRequest setException(Exception exception) {
64          this.exception = exception;
65          return this;
66      }
67  
68      public String getMessage() {
69          return message;
70      }
71  
72      public ModelProblemCollectorRequest setMessage(String message) {
73          this.message = message;
74          return this;
75      }
76  
77      public InputLocation getLocation() {
78          return location;
79      }
80  
81      public ModelProblemCollectorRequest setLocation(InputLocation location) {
82          this.location = location;
83          return this;
84      }
85  }