package org.ehcache.impl.internal.classes;
import static java.util.Arrays.asList;
import java.util.List;
public class ClassInstanceConfiguration<T> {
private final Class<? extends T> clazz;
private final List<Object> arguments;
private final T instance;
public ClassInstanceConfiguration(Class<? extends T> clazz, Object... arguments) {
this.clazz = clazz;
this.arguments = asList(arguments.clone());
this.instance = null;
}
public ClassInstanceConfiguration(T instance) {
this.instance = instance;
@SuppressWarnings("unchecked")
Class<? extends T> instanceClass = (Class<? extends T>) instance.getClass();
this.clazz = instanceClass;
this.arguments = null;
}
public Class<? extends T> getClazz() {
return clazz;
}
public Object[] getArguments() {
return arguments.toArray();
}
public T getInstance() {
return instance;
}
}