All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.maven.model.Extension Maven / Gradle / Ivy

The newest version!
/*
 =================== DO NOT EDIT THIS FILE ====================
 Generated by Modello 1.0.1 on 2009-08-06 15:13:09,
 any modifications will be overwritten.
 ==============================================================
 */

package org.apache.maven.model;

/**
 * Describes a build extension to utilise.
 * 
 * @version $Revision$ $Date$
 */
public class Extension
    implements java.io.Serializable
{

      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * The group ID of the extension's artifact.
     */
    private String groupId;

    /**
     * The artifact ID of the extension.
     */
    private String artifactId;

    /**
     * The version of the extension.
     */
    private String version;


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Get the artifact ID of the extension.
     * 
     * @return String
     */
    public String getArtifactId()
    {
        return this.artifactId;
    } //-- String getArtifactId()

    /**
     * Get the group ID of the extension's artifact.
     * 
     * @return String
     */
    public String getGroupId()
    {
        return this.groupId;
    } //-- String getGroupId()

    /**
     * Get the version of the extension.
     * 
     * @return String
     */
    public String getVersion()
    {
        return this.version;
    } //-- String getVersion()

    /**
     * Set the artifact ID of the extension.
     * 
     * @param artifactId
     */
    public void setArtifactId( String artifactId )
    {
        this.artifactId = artifactId;
    } //-- void setArtifactId( String )

    /**
     * Set the group ID of the extension's artifact.
     * 
     * @param groupId
     */
    public void setGroupId( String groupId )
    {
        this.groupId = groupId;
    } //-- void setGroupId( String )

    /**
     * Set the version of the extension.
     * 
     * @param version
     */
    public void setVersion( String version )
    {
        this.version = version;
    } //-- void setVersion( String )


            
    /**
     * Gets the key of the extension. The key is used to merge extensions inherited from a parent with the extensions
     * of the current project.
     *
     * @return The key of the extension, i.e. groupId:artifactId.
     */
    public String getKey()
    {
        return new StringBuffer( 128 ).append( getGroupId() ).append( ':' ).append( getArtifactId() ).toString();
    }

    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals( Object o )
    {
        if ( this == o )
        {
            return true;
        }

        if ( !( o instanceof Extension ) )
        {
            return false;
        }

        Extension e = (Extension) o;

        if ( !equal( e.getArtifactId(), getArtifactId() ) )
        {
            return false;
        }
        else if ( !equal( e.getGroupId(), getGroupId() ) )
        {
            return false;
        }
        else if ( !equal( e.getVersion(), getVersion() ) )
        {
            return false;
        }
        return true;
    }

    private static  boolean equal( T obj1, T obj2 )
    {
        return ( obj1 != null ) ? obj1.equals( obj2 ) : obj2 == null;
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode()
    {
        int result = 17;
        result = 37 * result + ( getArtifactId() != null ? getArtifactId().hashCode() : 0 );
        result = 37 * result + ( getGroupId() != null ? getGroupId().hashCode() : 0 );
        result = 37 * result + ( getVersion() != null ? getVersion().hashCode() : 0 );
        return result;
    }
            
          
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy