All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonarsource.sonarlint.shaded.org.picocontainer.BindKey Maven / Gradle / Ivy

There is a newer version: 10.1.0.77731
Show newest version
/*****************************************************************************
 * 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);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy