@Override public String toString() { StringBuilder buffer = new StringBuilder( 128 ); buffer.append( getGroupId() ); buffer.append( ':' ).append( getArtifactId() ); buffer.append( ':' ).append( getExtension() ); if ( getClassifier().length() > 0 ) { buffer.append( ':' ).append( getClassifier() ); } buffer.append( ':' ).append( getVersion() ); return buffer.toString(); }
@Override public int hashCode() { int hash = 17; hash = hash * 31 + getGroupId().hashCode(); hash = hash * 31 + getArtifactId().hashCode(); hash = hash * 31 + getExtension().hashCode(); hash = hash * 31 + getClassifier().hashCode(); hash = hash * 31 + getVersion().hashCode(); hash = hash * 31 + hash( getFile() ); return hash; }
@Override public boolean equals( Object obj ) { if ( obj == this ) { return true; } else if ( !( obj instanceof Artifact ) ) { return false; } Artifact that = (Artifact) obj; return getArtifactId().equals( that.getArtifactId() ) && getGroupId().equals( that.getGroupId() ) && getVersion().equals( that.getVersion() ) && getExtension().equals( that.getExtension() ) && getClassifier().equals( that.getClassifier() ) && eq( getFile(), that.getFile() ) && getProperties().equals( that.getProperties() ); }
public Artifact setVersion( String version ) { if ( getVersion().equals( version ) ) { return this; } return newInstance( getGroupId(), getArtifactId(), getClassifier(), getExtension(), version, getProperties(), getFile() ); }
public Artifact setProperties( Map<String, String> properties ) { if ( getProperties().equals( properties ) ) { return this; } return newInstance( getGroupId(), getArtifactId(), getClassifier(), getExtension(), getVersion(), copy( properties ), getFile() ); }
public Artifact setFile( File file ) { if ( eq( getFile(), file ) ) { return this; } return newInstance( getGroupId(), getArtifactId(), getClassifier(), getExtension(), getVersion(), getProperties(), file ); }