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

com.google.inject.assistedinject.ParameterListKey Maven / Gradle / Ivy

package com.google.inject.assistedinject;

import com.google.inject.TypeLiteral;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * A list of {@link TypeLiteral}s to match an injectable Constructor's assited
 * parameter types to the corresponding factory method.
 */
class ParameterListKey {

    private final List paramList;

    public ParameterListKey(List paramList) {
        this.paramList = new ArrayList(paramList);
    }

    public ParameterListKey(Type[] types) {
        this(Arrays.asList(types));
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof ParameterListKey)) {
            return false;
        }
        ParameterListKey other = (ParameterListKey) o;
        return paramList.equals(other.paramList);
    }

    @Override
    public int hashCode() {
        return paramList.hashCode();
    }

    @Override
    public String toString() {
        return paramList.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy