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.tools.plugin;
20  
21  import java.util.Objects;
22  
23  import org.apache.maven.plugin.descriptor.MojoDescriptor;
24  import org.apache.maven.plugin.descriptor.Parameter;
25  
26  /**
27   * Extensions to {@link MojoDescriptor} not supported by Maven 3.2.5.
28   *
29   * @author Kristian Rosenvold
30   */
31  public class ExtendedMojoDescriptor extends MojoDescriptor {
32      private final boolean containsXhtmlTextValues;
33      private boolean v4Api;
34  
35      public ExtendedMojoDescriptor() {
36          this(false);
37      }
38  
39      /**
40       * @param containsXhtmlTextValues
41       * @since 3.7.0
42       */
43      public ExtendedMojoDescriptor(boolean containsXhtmlTextValues) {
44          this.containsXhtmlTextValues = containsXhtmlTextValues;
45      }
46  
47      /**
48       * Indicates if the methods {@link #getDescription()}, {@link #getDeprecated()}, {@link Parameter#getDescription()}
49       * and {@link Parameter#getDeprecated()} return XHTML values.
50       * @return {@code true} if aforementioned methods return XHTML values, if {@code false} those values contain
51       * javadoc (HTML + custom javadoc tags) (for legacy extractors)
52       * @since 3.7.0
53       */
54      public boolean containsXhtmlTextValues() {
55          return containsXhtmlTextValues;
56      }
57  
58      public boolean isV4Api() {
59          return v4Api;
60      }
61  
62      public void setV4Api(boolean v4Api) {
63          this.v4Api = v4Api;
64      }
65  
66      @Override
67      public int hashCode() {
68          final int prime = 31;
69          int result = super.hashCode();
70          result = prime * result + Objects.hash(containsXhtmlTextValues);
71          return result;
72      }
73  
74      @Override
75      public boolean equals(Object obj) {
76          if (this == obj) {
77              return true;
78          }
79          if (!super.equals(obj)) {
80              return false;
81          }
82          if (getClass() != obj.getClass()) {
83              return false;
84          }
85          ExtendedMojoDescriptor other = (ExtendedMojoDescriptor) obj;
86          return containsXhtmlTextValues == other.containsXhtmlTextValues;
87      }
88  }