001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.maven.tools.plugin;
020
021import java.util.Objects;
022
023import org.apache.maven.plugin.descriptor.MojoDescriptor;
024import org.apache.maven.plugin.descriptor.Parameter;
025
026/**
027 * Extensions to {@link MojoDescriptor} not supported by Maven 3.2.5.
028 *
029 * @author Kristian Rosenvold
030 */
031public class ExtendedMojoDescriptor extends MojoDescriptor {
032    private final boolean containsXhtmlTextValues;
033    private boolean v4Api;
034
035    public ExtendedMojoDescriptor() {
036        this(false);
037    }
038
039    /**
040     * @param containsXhtmlTextValues
041     * @since 3.7.0
042     */
043    public ExtendedMojoDescriptor(boolean containsXhtmlTextValues) {
044        this.containsXhtmlTextValues = containsXhtmlTextValues;
045    }
046
047    /**
048     * Indicates if the methods {@link #getDescription()}, {@link #getDeprecated()}, {@link Parameter#getDescription()}
049     * and {@link Parameter#getDeprecated()} return XHTML values.
050     * @return {@code true} if aforementioned methods return XHTML values, if {@code false} those values contain
051     * javadoc (HTML + custom javadoc tags) (for legacy extractors)
052     * @since 3.7.0
053     */
054    public boolean containsXhtmlTextValues() {
055        return containsXhtmlTextValues;
056    }
057
058    public boolean isV4Api() {
059        return v4Api;
060    }
061
062    public void setV4Api(boolean v4Api) {
063        this.v4Api = v4Api;
064    }
065
066    @Override
067    public int hashCode() {
068        final int prime = 31;
069        int result = super.hashCode();
070        result = prime * result + Objects.hash(containsXhtmlTextValues);
071        return result;
072    }
073
074    @Override
075    public boolean equals(Object obj) {
076        if (this == obj) {
077            return true;
078        }
079        if (!super.equals(obj)) {
080            return false;
081        }
082        if (getClass() != obj.getClass()) {
083            return false;
084        }
085        ExtendedMojoDescriptor other = (ExtendedMojoDescriptor) obj;
086        return containsXhtmlTextValues == other.containsXhtmlTextValues;
087    }
088}