public class Components extends Object
ComponentProvider
. The current ComponentProvider
is set
during start-up and there should be little reason to change it at runtime.
Since Magnolia 4.5, you are encouraged to use IoC, only in rare cases should you need to directly use this class.ComponentProvider
Constructor and Description |
---|
Components() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
getComponent(Class<T> type)
Returns a component from the currently set
ComponentProvider . |
static ComponentProvider |
getComponentProvider()
Returns the currently set
ComponentProvider . |
static <T> T |
getComponentWithAnnotation(Class<T> type,
Annotation annotation) |
static <T> T |
getSingleton(Class<T> type)
Deprecated.
since 4.5, use IoC to inject the component or use #getComponent(Class).
|
static javax.inject.Named |
named(String name) |
static <T> T |
newInstance(Class<T> type,
Object... parameters) |
static void |
popProvider() |
static void |
pushProvider(ComponentProvider provider) |
static void |
setComponentProvider(ComponentProvider provider)
Sets the current
ComponentProvider . |
public static void setComponentProvider(ComponentProvider provider)
ComponentProvider
.public static ComponentProvider getComponentProvider()
ComponentProvider
.public static void pushProvider(ComponentProvider provider)
public static void popProvider()
@Deprecated public static <T> T getSingleton(Class<T> type)
ComponentProvider
.ComponentProvider.getComponent(Class)
public static <T> T getComponent(Class<T> type)
ComponentProvider
. Consider using IoC to inject the component instead.public static <T> T getComponentWithAnnotation(Class<T> type, Annotation annotation)
public static javax.inject.Named named(String name)
Copyright © 2003–2017 Magnolia International Ltd.. All rights reserved.