public class ContainerUtil extends Object
| Constructor and Description |
|---|
ContainerUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addComponentLifecyclePlugin(ExoContainer container,
ConfigurationManager conf) |
static void |
addComponents(ExoContainer container,
ConfigurationManager conf) |
static void |
addContainerLifecyclePlugin(ExoContainer container,
ConfigurationManager conf) |
static <T> T |
createProxy(Class<T> superClass,
javax.inject.Provider<T> provider)
Creates a proxy of the given super class whose instance will be created accessed lazily thanks to a provider
|
static Collection<URL> |
getConfigurationURL(String configuration) |
static Class<? extends Annotation> |
getScope(Class<?> clazz)
Gives the scope defined for the given class
|
static Class<? extends Annotation> |
getScope(Class<?> clazz,
boolean ignoreExplicit)
Gives the scope defined for the given class
|
static String |
getServletContextName(javax.servlet.ServletContext context)
Gives the context name thanks to the method
ServletContext.getServletContextName() if not null
otherwise it will extract the value from the value of ServletContext.getContextPath() |
static Constructor<?>[] |
getSortedConstructors(Class<?> clazz) |
static boolean |
hasFieldOrMethodWithInject(Class<?> clazz)
Indicates whether or not this class or one of its super class has at least one
Inject annotation on a field or a method
|
static boolean |
hasInjectableConstructor(Class<?> clazz)
Indicates whether or not the given Class has a constructor annotated with Inject
|
static boolean |
hasOnlyEmptyPublicConstructor(Class<?> clazz)
Indicates whether or not the given Class has only a public non argument constructor
|
static boolean |
isSingleton(Class<?> clazz)
Indicates whether or not the given Class is a singleton or as the scope set to ApplicationScoped
|
static Map<String,String> |
loadProperties(URL url)
Loads the properties file corresponding to the given url
|
static Map<String,String> |
loadProperties(URL url,
boolean resolveVariables)
Loads the properties file corresponding to the given url
|
public static Constructor<?>[] getSortedConstructors(Class<?> clazz) throws NoClassDefFoundError
NoClassDefFoundErrorpublic static boolean hasInjectableConstructor(Class<?> clazz)
public static boolean hasOnlyEmptyPublicConstructor(Class<?> clazz)
public static boolean hasFieldOrMethodWithInject(Class<?> clazz)
public static Class<? extends Annotation> getScope(Class<?> clazz) throws DefinitionException
clazz - the class for which we want the scopeDefinitionException - in case the definition of the scope is not correctpublic static Class<? extends Annotation> getScope(Class<?> clazz, boolean ignoreExplicit) throws DefinitionException
clazz - the class for which we want the scopeignoreExplicit - indicates whether the explicit scope must be ignoredDefinitionException - in case the definition of the scope is not correctpublic static boolean isSingleton(Class<?> clazz)
public static Collection<URL> getConfigurationURL(String configuration) throws Exception
Exceptionpublic static void addContainerLifecyclePlugin(ExoContainer container, ConfigurationManager conf)
public static void addComponentLifecyclePlugin(ExoContainer container, ConfigurationManager conf)
public static void addComponents(ExoContainer container, ConfigurationManager conf)
public static Map<String,String> loadProperties(URL url)
url - the url of the properties fileMap of propertiespublic static Map<String,String> loadProperties(URL url, boolean resolveVariables)
url - the url of the properties fileresolveVariables - indicates if the variables must be resolvedMap of propertiespublic static <T> T createProxy(Class<T> superClass, javax.inject.Provider<T> provider) throws javax.enterprise.inject.UnproxyableResolutionException
superClass - the super class of the proxy to createprovider - the provider that will create the instance lazilyjavax.enterprise.inject.UnproxyableResolutionException - if any issue occurs while creating the proxypublic static String getServletContextName(javax.servlet.ServletContext context)
ServletContext.getServletContextName() if not null
otherwise it will extract the value from the value of ServletContext.getContextPath()context - the context from which we want to extract the name of the contextCopyright © 2019 eXo Platform SAS. All Rights Reserved.