public class InjectableObjectContainer
extends Object
Constructor and Description |
---|
InjectableObjectContainer() |
Modifier and Type | Method and Description |
---|---|
void |
add(Object defaultObject)
Registers the supplied object as a default object.
|
Object |
get(Class<?> type)
Returns the default object which is suitable for the specified type.
|
public void add(Object defaultObject)
defaultObject
- The object to be registeredpublic Object get(Class<?> type) throws IllegalArgumentException
type
- The type for which a default object is requested.IllegalArgumentException
- if zero or more than one object has been registered which is
assignable to the specified type.