public class DefaultComponentProvider extends Object implements ComponentProvider
ComponentProvider
is using the configuration provided by
SystemProperty
. Each property key is the interface/base-class, and the value
is either the implementation-to-use class name, an implementation of ComponentFactory
which is used to instantiate the desired implementation, or the path to a node in the repository (in the form of
repository:/path/to/node
or /path/to/node
, which defaults to the config
repository). In the latter case, the component is constructed via ObservedComponentFactory
and reflects (through observation) the contents of the given path.Constructor and Description |
---|
DefaultComponentProvider(MagnoliaConfigurationProperties mappings)
Deprecated.
|
DefaultComponentProvider(Properties mappings)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Deprecated.
Used only in tests.
|
<T> T |
getComponent(Class<T> type)
Deprecated.
Returns the component mapped for a given type.
|
<C> Class<? extends C> |
getImplementation(Class<C> type)
Deprecated.
Returns the implementation type mapped for a given type.
|
protected String |
getImplementationName(Class<?> type)
Deprecated.
|
ComponentProvider |
getParent()
Deprecated.
|
<T> T |
getSingleton(Class<T> type)
Deprecated.
|
protected boolean |
isConcrete(Class<?> clazz)
Deprecated.
since 4.5, use
Classes.isConcrete(Class) |
<T> T |
newInstance(Class<T> type,
Object... parameters)
Deprecated.
Creates a new instance of the passed interface / class by using the registered implementation.
|
<T> T |
newInstanceWithParameterResolvers(Class<T> type,
ParameterResolver... parameters)
Deprecated.
|
void |
setImplementation(Class<?> type,
String impl)
Deprecated.
Used only in tests.
|
void |
setInstance(Class<?> type,
Object instance)
Deprecated.
Used only in tests.
|
void |
setInstanceFactory(Class<?> type,
ComponentFactory<?> factory)
Deprecated.
Used only in tests.
|
public DefaultComponentProvider(MagnoliaConfigurationProperties mappings)
public DefaultComponentProvider(Properties mappings)
@Deprecated public <T> T getSingleton(Class<T> type)
ComponentProvider
getSingleton
in interface ComponentProvider
ComponentProvider.getComponent(Class)
public <T> T getComponent(Class<T> type)
ComponentProvider
getComponent
in interface ComponentProvider
public <T> T newInstance(Class<T> type, Object... parameters)
ComponentProvider
MgnlInstantiationException
is thrown.newInstance
in interface ComponentProvider
public <T> T newInstanceWithParameterResolvers(Class<T> type, ParameterResolver... parameters)
newInstanceWithParameterResolvers
in interface ComponentProvider
protected boolean isConcrete(Class<?> clazz)
Classes.isConcrete(Class)
public <C> Class<? extends C> getImplementation(Class<C> type) throws ClassNotFoundException
ComponentProvider
getImplementation
in interface ComponentProvider
ClassNotFoundException
- in case there's no implementation for the provided typepublic ComponentProvider getParent()
getParent
in interface ComponentProvider
public void setImplementation(Class<?> type, String impl)
info.magnolia.test.ComponentsTestUtil
public void setInstance(Class<?> type, Object instance)
info.magnolia.test.ComponentsTestUtil
public void setInstanceFactory(Class<?> type, ComponentFactory<?> factory)
info.magnolia.test.ComponentsTestUtil
public void clear()
info.magnolia.test.ComponentsTestUtil
Copyright © 2003–2015 Magnolia International Ltd.. All rights reserved.