]>
git.argeo.org Git - gpl/argeo-slc.git/blob - cms/org.argeo.slc.repo/src/org/eclipse/aether/graph/Exclusion.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 2011 Sonatype, Inc.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Sonatype, Inc. - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.aether
.graph
;
14 * An exclusion of one or more transitive dependencies. <em>Note:</em> Instances of this class are immutable and the
15 * exposed mutators return new objects rather than changing the current instance.
17 * @see Dependency#getExclusions()
19 public final class Exclusion
22 private final String groupId
;
24 private final String artifactId
;
26 private final String classifier
;
28 private final String extension
;
31 * Creates an exclusion for artifacts with the specified coordinates.
33 * @param groupId The group identifier, may be {@code null}.
34 * @param artifactId The artifact identifier, may be {@code null}.
35 * @param classifier The classifier, may be {@code null}.
36 * @param extension The file extension, may be {@code null}.
38 public Exclusion( String groupId
, String artifactId
, String classifier
, String extension
)
40 this.groupId
= ( groupId
!= null ) ? groupId
: "";
41 this.artifactId
= ( artifactId
!= null ) ? artifactId
: "";
42 this.classifier
= ( classifier
!= null ) ? classifier
: "";
43 this.extension
= ( extension
!= null ) ? extension
: "";
47 * Gets the group identifier for artifacts to exclude.
49 * @return The group identifier, never {@code null}.
51 public String
getGroupId()
57 * Gets the artifact identifier for artifacts to exclude.
59 * @return The artifact identifier, never {@code null}.
61 public String
getArtifactId()
67 * Gets the classifier for artifacts to exclude.
69 * @return The classifier, never {@code null}.
71 public String
getClassifier()
77 * Gets the file extension for artifacts to exclude.
79 * @return The file extension of artifacts to exclude, never {@code null}.
81 public String
getExtension()
87 public String
toString()
89 return getGroupId() + ':' + getArtifactId() + ':' + getExtension()
90 + ( getClassifier().length() > 0 ?
':' + getClassifier() : "" );
94 public boolean equals( Object obj
)
100 else if ( obj
== null || !getClass().equals( obj
.getClass() ) )
105 Exclusion that
= (Exclusion
) obj
;
107 return artifactId
.equals( that
.artifactId
) && groupId
.equals( that
.groupId
)
108 && extension
.equals( that
.extension
) && classifier
.equals( that
.classifier
);
112 public int hashCode()
115 hash
= hash
* 31 + artifactId
.hashCode();
116 hash
= hash
* 31 + groupId
.hashCode();
117 hash
= hash
* 31 + classifier
.hashCode();
118 hash
= hash
* 31 + extension
.hashCode();