mirror of https://github.com/apache/maven.git
Refactor to use StringBuffer in DefaultArtifact getDependencyConflictId and toString
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@373072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b6d0cf174f
commit
e46a983a42
|
@ -224,8 +224,23 @@ public class DefaultArtifact
|
|||
|
||||
public String getDependencyConflictId()
|
||||
{
|
||||
return getGroupId() + ":" + getArtifactId() + ":" + getType() +
|
||||
( hasClassifier() ? ":" + getClassifier() : "" );
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append( getGroupId() );
|
||||
sb.append( ":" );
|
||||
appendArtifactTypeClassifierString( sb );
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void appendArtifactTypeClassifierString( StringBuffer sb )
|
||||
{
|
||||
sb.append( getArtifactId() );
|
||||
sb.append( ":" );
|
||||
sb.append( getType() );
|
||||
if ( hasClassifier() )
|
||||
{
|
||||
sb.append( ":" );
|
||||
sb.append( getClassifier() );
|
||||
}
|
||||
}
|
||||
|
||||
public void addMetadata( ArtifactMetadata metadata )
|
||||
|
@ -257,9 +272,22 @@ public class DefaultArtifact
|
|||
|
||||
public String toString()
|
||||
{
|
||||
return getDependencyConflictId() + ":" +
|
||||
( version != null || baseVersion != null ? getBaseVersion() : versionRange.toString() ) +
|
||||
":" + scope;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append( getGroupId() );
|
||||
sb.append( ":" );
|
||||
appendArtifactTypeClassifierString( sb );
|
||||
sb.append( ":" );
|
||||
if ( version != null || baseVersion != null )
|
||||
{
|
||||
sb.append( getBaseVersion() );
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append( versionRange.toString() );
|
||||
}
|
||||
sb.append( ":" );
|
||||
sb.append( scope );
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
|
|
Loading…
Reference in New Issue