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

com.browserup.bup.proxy.guice.NamedImpl Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package com.browserup.bup.proxy.guice;

import com.google.inject.name.Named;

import java.lang.annotation.Annotation;

public class NamedImpl implements Named {
    final String value;

    public NamedImpl(String value) {
        this.value = value == null ? "name" : value;
    }

    @Override
    public String value() {
        return this.value;
    }

    public int hashCode() {
        // This is specified in java.lang.Annotation.
        return 127 * "value".hashCode() ^ value.hashCode();
    }

    public boolean equals(Object o) {
        if (!(o instanceof Named)) {
            return false;
        }

        Named other = (Named) o;
        return value.equals(other.value());
    }

    public String toString() {
        return "@" + Named.class.getName() + "(value=" + value + ")";
    }

    @Override
    public Class annotationType() {
        return Named.class;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy