protected static boolean pluginEquals( Plugin a, Plugin b ) { return CacheUtils.pluginEquals( a, b ); }
protected static int pluginHashCode( Plugin plugin ) { return CacheUtils.pluginHashCode( plugin ); }
private static boolean dependenciesEquals( List<Dependency> a, List<Dependency> b ) { if ( a.size() != b.size() ) { return false; } Iterator<Dependency> aI = a.iterator(); Iterator<Dependency> bI = b.iterator(); while ( aI.hasNext() ) { Dependency aD = aI.next(); Dependency bD = bI.next(); boolean r = Objects.equals( aD.getGroupId(), bD.getGroupId() ) // && Objects.equals( aD.getArtifactId(), bD.getArtifactId() ) // && Objects.equals( aD.getVersion(), bD.getVersion() ) // && Objects.equals( aD.getType(), bD.getType() ) // && Objects.equals( aD.getClassifier(), bD.getClassifier() ) // && Objects.equals( aD.getScope(), bD.getScope() ); r &= exclusionsEquals( aD.getExclusions(), bD.getExclusions() ); if ( !r ) { return false; } } return true; }
public static boolean pluginEquals( Plugin a, Plugin b ) { return Objects.equals( a.getArtifactId(), b.getArtifactId() ) // && Objects.equals( a.getGroupId(), b.getGroupId() ) // && Objects.equals( a.getVersion(), b.getVersion() ) // && a.isExtensions() == b.isExtensions() // && dependenciesEquals( a.getDependencies(), b.getDependencies() ); }
protected static int pluginHashCode( Plugin plugin ) { return CacheUtils.pluginHashCode( plugin ); }
protected static boolean pluginEquals( Plugin a, Plugin b ) { return CacheUtils.pluginEquals( a, b ); }
hash = hash * 31 + CacheUtils.pluginHashCode( plugin ); hash = hash * 31 + Objects.hashCode( workspace ); hash = hash * 31 + Objects.hashCode( localRepo );
@Override public boolean equals( Object o ) { if ( o == this ) { return true; } if ( !( o instanceof CacheKey ) ) { return false; } CacheKey that = (CacheKey) o; return CacheUtils.pluginEquals( plugin, that.plugin ) && Objects.equals( workspace, that.workspace ) && Objects.equals( localRepo, that.localRepo ) && RepositoryUtils.repositoriesEquals( repositories, that.repositories ) && Objects.equals( filter, that.filter ); } }
public CacheKey( Plugin plugin, DependencyFilter extensionFilter, List<RemoteRepository> repositories, RepositorySystemSession session ) { this.plugin = plugin.clone(); workspace = RepositoryUtils.getWorkspace( session ); this.localRepo = session.getLocalRepository(); this.repositories = new ArrayList<>( repositories.size() ); for ( RemoteRepository repository : repositories ) { if ( repository.isRepositoryManager() ) { this.repositories.addAll( repository.getMirroredRepositories() ); } else { this.repositories.add( repository ); } } this.filter = extensionFilter; int hash = 17; hash = hash * 31 + CacheUtils.pluginHashCode( plugin ); hash = hash * 31 + Objects.hashCode( workspace ); hash = hash * 31 + Objects.hashCode( localRepo ); hash = hash * 31 + RepositoryUtils.repositoriesHashCode( repositories ); hash = hash * 31 + Objects.hashCode( extensionFilter ); this.hashCode = hash; }
@Override public boolean equals( Object o ) { if ( o == this ) { return true; } if ( !( o instanceof CacheKey ) ) { return false; } CacheKey that = (CacheKey) o; return parentRealm == that.parentRealm && CacheUtils.pluginEquals( plugin, that.plugin ) && Objects.equals( workspace, that.workspace ) && Objects.equals( localRepo, that.localRepo ) && RepositoryUtils.repositoriesEquals( this.repositories, that.repositories ) && Objects.equals( filter, that.filter ) && Objects.equals( foreignImports, that.foreignImports ); } }