org.sonarsource.sonarlint.shaded.org.picocontainer.BindKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonarlint-core Show documentation
Show all versions of sonarlint-core Show documentation
Common library used by some SonarLint flavors
/*****************************************************************************
* Copyright (C) PicoContainer Committers. All rights reserved. *
* ------------------------------------------------------------------------- *
* The software in this package is published under the terms of the BSD *
* style license a copy of which has been included with this distribution in *
* the LICENSE.txt file. *
* *
* Original code by Joerg Schaibe *
*****************************************************************************/
package org.picocontainer;
import java.io.Serializable;
import java.lang.annotation.Annotation;
/** @author Paul Hammant */
@SuppressWarnings("serial")
public class BindKey implements Serializable {
private final Class type;
private final Class annotation;
public BindKey(Class type, Class annotation) {
this.type = type;
this.annotation = annotation;
}
public Class getType() {
return type;
}
public Class getAnnotation() {
return annotation;
}
public String toString() {
return type.getName() + ":" + annotation.getName();
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BindKey bindKey = (BindKey)o;
if (!annotation.equals(bindKey.annotation)) return false;
if (!type.equals(bindKey.type)) return false;
return true;
}
public int hashCode() {
int result;
result = type.hashCode();
result = 31 * result + annotation.hashCode();
return result;
}
public static BindKey bindKey(Class type, Class annotation) {
return new BindKey(type, annotation);
}
}