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

edu.isi.nlp.AbstractAnnotatedParameterizedModule Maven / Gradle / Ivy

The newest version!
package edu.isi.nlp;

import static com.google.common.base.Preconditions.checkNotNull;

import edu.isi.nlp.parameters.Parameters;
import java.lang.annotation.Annotation;
import java.util.Objects;

/**
 * A module which has the properties of {@link AbstractParameterizedModule}, except it also includes
 * an annotation class (which is also used in determinsing its identity for hashCode and equals).
 *
 * 

You might wish to use this if you are providing a generic capability (e.g. a string * normalizer) which you expect may be bound to multiple binding sites by multiple instances of the * same module. * * @author Ryan Gabbard */ public abstract class AbstractAnnotatedParameterizedModule extends AbstractParameterizedModule { private final Class annotation; protected AbstractAnnotatedParameterizedModule( final Parameters parameters, Class annotation) { super(parameters); this.annotation = checkNotNull(annotation); } protected final Class annotation() { return annotation; } @Override public int hashCode() { return Objects.hash(super.hashCode(), annotation); } @Override public boolean equals(final Object obj) { return super.equals(obj) && annotation.equals(((AbstractAnnotatedParameterizedModule) obj).annotation()); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy