
ch.dkitc.ridioc.DIObjectFactory Maven / Gradle / Ivy
package ch.dkitc.ridioc;
public interface DIObjectFactory {
/**
* Creates a fresh instance of a given type using constructor injection on a potential implementation type.
* Only ONE implementation of the given is allowed to be available in the scanned classpath.
* This method always returns a new instance of the give type.
*
* @param type the type to create an instance for
* @param params the parameters to be used to create
* @param describes the type parameter
* @return a newly created instance of the given type
* @throws IllegalArgumentException if {@code type} is {@code null}, if any of the given parameters is {@code null}, if no implementation type was found, or if 2 or more implementations types are found
*/
T newInstance(Class type, Object... params) throws IllegalArgumentException;
T instance(Class type) throws IllegalArgumentException;
T registerInstance(Class type, T instance) throws IllegalArgumentException;
String registerStringLiteral(String key, String value) throws IllegalArgumentException;
String[] registerStringLiteralArray(String key, String[] valuesArray) throws IllegalArgumentException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy