View Javadoc
1   package org.apache.maven.model.building;
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 org.apache.commons.lang3.Validate;
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   * @author mkleint
31   */
32  public final class ModelProblemCollectorRequest
33  {
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      {
48          this.severity = Validate.notNull( severity, "severity cannot be null" );
49          this.version = Validate.notNull( version, "version cannot be null" );
50      }
51  
52      public Severity getSeverity()
53      {
54          return severity;
55      }
56  
57      public Version getVersion()
58      {
59          return version;
60      }
61  
62      public Exception getException()
63      {
64          return exception;
65      }
66  
67      public ModelProblemCollectorRequest setException( Exception exception )
68      {
69          this.exception = exception;
70          return this;
71      }
72  
73      public String getMessage()
74      {
75          return message;
76      }
77  
78      public ModelProblemCollectorRequest setMessage( String message )
79      {
80          this.message = message;
81          return this;
82      }
83  
84      public InputLocation getLocation()
85      {
86          return location;
87      }
88  
89      public ModelProblemCollectorRequest setLocation( InputLocation location )
90      {
91          this.location = location;
92          return this;
93      }
94  }