Package org.exoplatform.container.util
Class ContainerUtil
java.lang.Object
org.exoplatform.container.util.ContainerUtil
- Since:
- Oct 28, 2004
- Version:
- $Id: ContainerUtil.java 9894 2006-10-31 02:52:41Z tuan08 $
- Author:
- Tuan Nguyen (tuan08@users.sourceforge.net)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddComponentLifecyclePlugin(ExoContainer container, ConfigurationManager conf) static voidaddComponents(ExoContainer container, ConfigurationManager conf) static voidaddContainerLifecyclePlugin(ExoContainer container, ConfigurationManager conf) static <T> TcreateProxy(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 providerstatic Collection<URL>getConfigurationURL(String configuration) static Class<? extends Annotation>Gives the scope defined for the given classstatic Class<? extends Annotation>Gives the scope defined for the given classstatic StringgetServletContextName(javax.servlet.ServletContext context) Gives the context name thanks to the methodServletContext.getServletContextName()if notnullotherwise it will extract the value from the value ofServletContext.getContextPath()static Constructor<?>[]getSortedConstructors(Class<?> clazz) static booleanhasFieldOrMethodWithInject(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 methodstatic booleanhasInjectableConstructor(Class<?> clazz) Indicates whether or not the given Class has a constructor annotated with Injectstatic booleanhasOnlyEmptyPublicConstructor(Class<?> clazz) Indicates whether or not the given Class has only a public non argument constructorstatic booleanisSingleton(Class<?> clazz) Indicates whether or not the given Class is a singleton or as the scope set to ApplicationScopedloadProperties(URL url) Loads the properties file corresponding to the given urlloadProperties(URL url, boolean resolveVariables) Loads the properties file corresponding to the given url
-
Constructor Details
-
ContainerUtil
public ContainerUtil()
-
-
Method Details
-
getSortedConstructors
- Throws:
NoClassDefFoundError
-
hasInjectableConstructor
Indicates whether or not the given Class has a constructor annotated with Inject -
hasOnlyEmptyPublicConstructor
Indicates whether or not the given Class has only a public non argument constructor -
hasFieldOrMethodWithInject
Indicates whether or not this class or one of its super class has at least one Inject annotation on a field or a method -
getScope
Gives the scope defined for the given class- Parameters:
clazz- the class for which we want the scope- Returns:
- a class representing the annotation type of the scope
- Throws:
DefinitionException- in case the definition of the scope is not correct
-
getScope
public static Class<? extends Annotation> getScope(Class<?> clazz, boolean ignoreExplicit) throws DefinitionException Gives the scope defined for the given class- Parameters:
clazz- the class for which we want the scopeignoreExplicit- indicates whether the explicit scope must be ignored- Returns:
- a class representing the annotation type of the scope
- Throws:
DefinitionException- in case the definition of the scope is not correct
-
isSingleton
Indicates whether or not the given Class is a singleton or as the scope set to ApplicationScoped -
getConfigurationURL
- Throws:
Exception
-
addContainerLifecyclePlugin
-
addComponentLifecyclePlugin
-
addComponents
-
loadProperties
Loads the properties file corresponding to the given url- Parameters:
url- the url of the properties file- Returns:
- a
Mapof properties
-
loadProperties
Loads the properties file corresponding to the given url- Parameters:
url- the url of the properties fileresolveVariables- indicates if the variables must be resolved- Returns:
- a
Mapof properties
-
createProxy
public static <T> T createProxy(Class<T> superClass, javax.inject.Provider<T> provider) throws javax.enterprise.inject.UnproxyableResolutionException Creates a proxy of the given super class whose instance will be created accessed lazily thanks to a provider- Parameters:
superClass- the super class of the proxy to createprovider- the provider that will create the instance lazily- Returns:
- a proxy of the given super class
- Throws:
javax.enterprise.inject.UnproxyableResolutionException- if any issue occurs while creating the proxy
-
getServletContextName
Gives the context name thanks to the methodServletContext.getServletContextName()if notnullotherwise it will extract the value from the value ofServletContext.getContextPath()- Parameters:
context- the context from which we want to extract the name of the context- Returns:
- the context name
-