[MNG-6948] Repository files should not pass build-filters

This commit is contained in:
rfscholte 2020-06-29 20:35:31 +02:00
parent 76427d2320
commit 65ec04c236

View File

@ -20,19 +20,25 @@
*/
import java.io.File;
import java.util.Objects;
import org.apache.maven.building.FileSource;
/**
* Represents a model pulled from a repository
*
* @author Robert Scholte
* @since 3.7.0
*/
public class ArtifactModelSource extends FileModelSource
public class ArtifactModelSource extends FileSource implements ModelSource
{
private final String groupId;
private final String artifactId;
private final String version;
private final int hashCode;
public ArtifactModelSource( File file, String groupId, String artifactId, String version )
{
@ -40,6 +46,7 @@ public ArtifactModelSource( File file, String groupId, String artifactId, String
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
this.hashCode = Objects.hash( groupId, artifactId, version );
}
public String getGroupId()
@ -56,4 +63,33 @@ public String getVersion()
{
return version;
}
@Override
public int hashCode()
{
return hashCode;
}
@Override
public boolean equals( Object obj )
{
if ( this == obj )
{
return true;
}
if ( obj == null )
{
return false;
}
if ( !ArtifactModelSource.class.equals( obj.getClass() ) )
{
return false;
}
ArtifactModelSource other = (ArtifactModelSource) obj;
return Objects.equals( artifactId, other.artifactId )
&& Objects.equals( groupId, other.groupId )
&& Objects.equals( version, other.version );
}
}