public class WeldUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
WeldUtils.BDAType
Bean Deployment Archive type.
|
Modifier and Type | Field and Description |
---|---|
static String |
BEANS_XML_FILENAME |
protected static List<String> |
cdiEnablingAnnotations |
protected static List<String> |
cdiScopeAnnotations |
static String |
CLASS_SUFFIX |
protected static List<String> |
excludedAnnotationTypes |
static String |
EXPANDED_JAR_SUFFIX |
static String |
EXPANDED_RAR_SUFFIX |
static String |
JAR_SUFFIX |
static String |
META_INF_BEANS_XML |
static String |
META_INF_SERVICES_EXTENSION |
static String |
RAR_SUFFIX |
static char |
SEPARATOR_CHAR |
static String |
WEB_INF |
static String |
WEB_INF_BEANS_XML |
static String |
WEB_INF_CLASSES |
static String |
WEB_INF_CLASSES_META_INF_BEANS_XML |
static String |
WEB_INF_LIB |
Constructor and Description |
---|
WeldUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
getBeanDiscoveryMode(InputStream beansXmlInputStream)
Get the "bean-discovery-mode" from the "beans" element if it exists in beans.xml
From section 12.1 of CDI spec:
A bean archive has a bean discovery mode of all, annotated or none.
|
static InputStream |
getBeansXmlInputStream(DeploymentContext context) |
static InputStream |
getBeansXmlInputStream(ReadableArchive archive) |
static Collection<String> |
getCDIAnnotatedClassNames(DeploymentContext context)
Get the names of any classes that are annotated with bean-defining annotations, which should
enable CDI processing even in the absence of a beans.xml descriptor.
|
static String[] |
getCDIEnablingAnnotations(DeploymentContext context)
Get the names of any annotation types that are applied to beans, which should enable CDI
processing even in the absence of a beans.xml descriptor.
|
static int |
getPreLoaderThreads() |
static boolean |
hasCDIEnablingAnnotation(Class clazz)
Determine whether the specified class is annotated with a CDI-enabling annotation.
|
static boolean |
hasCDIEnablingAnnotations(DeploymentContext context,
Collection<URI> paths)
Determine whether there are any beans annotated with annotations that should enable CDI
processing even in the absence of a beans.xml descriptor.
|
static boolean |
hasCDIEnablingAnnotations(DeploymentContext context,
URI path)
Determine whether there are any beans annotated with annotations that should enable CDI
processing even in the absence of a beans.xml descriptor.
|
static boolean |
hasScopeAnnotation(Class clazz)
Determine whether the specified class is annotated with a CDI scope annotation.
|
static boolean |
hasValidAnnotation(Class annotatedClass,
Collection<String> validScopes,
Collection<String> excludedScopes)
Determine whether the specified class is annotated with one of the annotations in the specified
validScopes collection, but not with any of the annotations in the specified exclusion set.
|
static boolean |
isCDIDevModeEnabled(DeploymentContext context) |
static boolean |
isConcurrentDeploymentEnabled() |
static boolean |
isImplicitBeanArchive(DeploymentContext context,
ReadableArchive archive)
Determine whether the specified archive is an implicit bean deployment archive.
|
static boolean |
isImplicitBeanArchive(DeploymentContext context,
URI archivePath)
Determine whether the specified archive is an implicit bean deployment archive.
|
static boolean |
isImplicitBeanDiscoveryEnabled() |
static boolean |
isImplicitBeanDiscoveryEnabled(DeploymentContext context) |
protected static boolean |
isValidAnnotation(Class<? extends Annotation> annotationType,
Collection<String> validTypeNames,
Collection<String> excludedTypeNames)
Determine whether the specified annotation type is one of the specified valid types and not
in the specified exclusion list.
|
static boolean |
isValidBdaBasedOnExtensionAndBeansXml(ReadableArchive archive)
Determine if an archive is a valid bda based on what the spec says about extensions.
|
static void |
setCDIDevMode(DeploymentContext context,
boolean enabled) |
public static final char SEPARATOR_CHAR
public static final String WEB_INF
public static final String WEB_INF_CLASSES
public static final String WEB_INF_LIB
public static final String BEANS_XML_FILENAME
public static final String WEB_INF_BEANS_XML
public static final String META_INF_BEANS_XML
public static final String WEB_INF_CLASSES_META_INF_BEANS_XML
public static final String META_INF_SERVICES_EXTENSION
public static final String CLASS_SUFFIX
public static final String JAR_SUFFIX
public static final String RAR_SUFFIX
public static final String EXPANDED_RAR_SUFFIX
public static final String EXPANDED_JAR_SUFFIX
public static boolean isImplicitBeanArchive(DeploymentContext context, ReadableArchive archive) throws IOException
context
- The deployment contextarchive
- The archive in questionIOException
public static boolean isImplicitBeanArchive(DeploymentContext context, URI archivePath)
context
- The deployment contextarchivePath
- The URI of the archivepublic static boolean hasCDIEnablingAnnotations(DeploymentContext context, URI path)
context
- The DeploymentContextpath
- The path to check for annotated beanspublic static boolean hasCDIEnablingAnnotations(DeploymentContext context, Collection<URI> paths)
context
- The DeploymentContextpaths
- The paths to check for annotated beanspublic static String[] getCDIEnablingAnnotations(DeploymentContext context)
context
- The DeploymentContextpublic static Collection<String> getCDIAnnotatedClassNames(DeploymentContext context)
context
- The DeploymentContextpublic static boolean hasScopeAnnotation(Class clazz)
clazz
- The class to check.public static boolean hasCDIEnablingAnnotation(Class clazz)
clazz
- The class to check.public static boolean hasValidAnnotation(Class annotatedClass, Collection<String> validScopes, Collection<String> excludedScopes)
annotatedClass
- The class to check.validScopes
- A collection of valid CDI scope type namesexcludedScopes
- A collection of excluded CDI scope type namesprotected static boolean isValidAnnotation(Class<? extends Annotation> annotationType, Collection<String> validTypeNames, Collection<String> excludedTypeNames)
annotationType
- The annotation type to checkvalidTypeNames
- The valid annotation type namesexcludedTypeNames
- The excluded annotation type namespublic static int getPreLoaderThreads()
public static boolean isConcurrentDeploymentEnabled()
public static boolean isImplicitBeanDiscoveryEnabled()
public static boolean isImplicitBeanDiscoveryEnabled(DeploymentContext context)
public static boolean isCDIDevModeEnabled(DeploymentContext context)
public static void setCDIDevMode(DeploymentContext context, boolean enabled)
public static InputStream getBeansXmlInputStream(DeploymentContext context)
public static boolean isValidBdaBasedOnExtensionAndBeansXml(ReadableArchive archive)
archive
- The archive to check.public static InputStream getBeansXmlInputStream(ReadableArchive archive)
public static String getBeanDiscoveryMode(InputStream beansXmlInputStream)
beansXmlInputStream
- The InputStream for the beans.xml to check.Copyright © 2019. All rights reserved.