it.espr.injector.Bean Maven / Gradle / Ivy
package it.espr.injector;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
public class Bean {
public final String name;
public final String key;
public final boolean singleton;
public final Class type;
public final Constructor constructor;
public final List> constructorParameters;
public final Map> fields;
public final Type instance;
public Bean(Type instance, String name, String key) {
this.instance = instance;
this.name = name;
this.key = key;
this.singleton = true;
this.type = null;
this.constructor = null;
this.constructorParameters = null;
this.fields = null;
}
public Bean(String name, String key, boolean singleton, Class type, Constructor constructor, List> constructorParameters, Map> fields) {
super();
this.name = name;
this.key = key;
this.singleton = singleton;
this.type = type;
this.constructor = constructor;
this.constructorParameters = constructorParameters;
this.fields = fields;
this.instance = null;
}
@Override
public int hashCode() {
return key.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass())
return false;
Bean> other = (Bean>) obj;
return key.equals(other.key);
}
}