Top Description Fields Constructors Methods
com.sun.faces.spi

public abstract Class AnnotationProvider

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.faces.config.manager.spi.AnnotationScanner, com.sun.faces.config.manager.spi.FilterClassesFromFacesInitializerAnnotationProvider
Imports
java.lang.annotation.Annotation, java.net.URI, java.util.Map, .ServiceLoader, .Set, jakarta.servlet.ServletContext

An integration point for integrators to provide custom annotation scanning.

All AnnotationProvider implementations must scan for the following annotations:

The AnnotationProvider instance will be wrapped as a java.util.concurrent.Future and executed during the environment initialization. The result of the future can be obtained by calling com.sun.faces.config.ConfigManager#getAnnotatedClasses(jakarta.faces.context.FacesContext).

The java.util.concurrent.Future itself can be obtained from the application map using the key com.sun.faces.config.ConfigManager__ANNOTATION_SCAN_TASK.

It's important to note that the value returned by either method described above is only available while the application is being initialized and will be removed before the application is put into service.

To register a custom AnnotationProvider with the runtime, place a file named com.sun.faces.spi.annotationprovider within META-INF/services of a JAR file, with a single line referencing the fully qualified class name of the AnnotationProvider implementation. Custom AnnotationProviders can be used to decorate the default AnnotationProvider by providing a constructor that takes an AnnotationProvider as the second parameter:

public AnnotationProvider(ServletContext sc, AnnotationProvider parent)

If decoration is not desired, then the custom provider must have a constructor that takes one paramer, a ServletContext:

public AnnotationProvider(ServletContext sc)

All customer providers must extend this class.

Field Summary

Modifier and TypeField and Description
protected ServletContext
protected AnnotationProvider
wrappedAnnotationProvider

The wrapped annotation provider.

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public abstract Map<Class<? extends Annotation>, Set<Class<?>>>

Returns:

a Map of classes mapped to a specific annotation type. If no annotations are present, this method returns an empty Map.
getAnnotatedClasses
(Set<URI>
a Set of URLs that refer to specific faces-config.xml documents on the classpath. The information returned by the map may return annotation information from sources outside of those defined by the urls.
urls
)

pack-priv final void
initialize(ServletContext servletContext, AnnotationProvider wrappedAnnotationProvider)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

servletContextback to summary
protected ServletContext servletContext
wrappedAnnotationProviderback to summary
protected AnnotationProvider wrappedAnnotationProvider

The wrapped annotation provider. May be null if this class is not loaded via ServiceLoader (from a file named com.sun.faces.spi.AnnotationProvider) and is instead loaded via Mojarra's ServiceFactory (from a file named com.sun.faces.spi.annotationprovider).

Constructor Detail

AnnotationProviderback to summary
public AnnotationProvider(ServletContext servletContext)
AnnotationProviderback to summary
public AnnotationProvider()

Method Detail

getAnnotatedClassesback to summary
public abstract Map<Class<? extends Annotation>, Set<Class<?>>> getAnnotatedClasses(Set<URI> urls)
Parameters
urls:Set<URI>

a Set of URLs that refer to specific faces-config.xml documents on the classpath. The information returned by the map may return annotation information from sources outside of those defined by the urls.

Returns:Map<Class<? extends Annotation>, Set<Class<?>>>

a Map of classes mapped to a specific annotation type. If no annotations are present, this method returns an empty Map.

initializeback to summary
pack-priv final void initialize(ServletContext servletContext, AnnotationProvider wrappedAnnotationProvider)