-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a specific type for modelling an exclusion
- Loading branch information
1 parent
412070d
commit 985c3b6
Showing
12 changed files
with
143 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/main/java/io/spring/gradle/dependencymanagement/internal/Exclusion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright 2014-2020 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.spring.gradle.dependencymanagement.internal; | ||
|
||
/** | ||
* An exclusion of an artifact by group ID and artifact ID. | ||
* | ||
* @author Andy Wilkinson | ||
*/ | ||
public class Exclusion { | ||
|
||
private final String groupId; | ||
|
||
private final String artifactId; | ||
|
||
/** | ||
* Creates a new {@code Exclusion} using the given {@code groupId} and {@code artifactId}. | ||
* | ||
* @param groupId group ID | ||
* @param artifactId artifact ID | ||
*/ | ||
public Exclusion(String groupId, String artifactId) { | ||
this.groupId = groupId; | ||
this.artifactId = artifactId; | ||
} | ||
|
||
/** | ||
* Returns the group ID that is excluded. | ||
* @return the group ID | ||
*/ | ||
public String getGroupId() { | ||
return groupId; | ||
} | ||
|
||
/** | ||
* Returns the artifact ID that is excluded. | ||
* @return the artifact ID | ||
*/ | ||
public String getArtifactId() { | ||
return artifactId; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = 1; | ||
result = 31 * result + artifactId.hashCode(); | ||
result = 31 * result + groupId.hashCode(); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) { | ||
return true; | ||
} | ||
if (obj == null) { | ||
return false; | ||
} | ||
if (getClass() != obj.getClass()) { | ||
return false; | ||
} | ||
Exclusion other = (Exclusion) obj; | ||
if (!artifactId.equals(other.artifactId)) { | ||
return false; | ||
} | ||
if (!groupId.equals(other.groupId)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.