org.apache.myfaces.spi
Class AnnotationProvider

java.lang.Object
  extended by org.apache.myfaces.spi.AnnotationProvider
All Implemented Interfaces:
FacesWrapper<AnnotationProvider>
Direct Known Subclasses:
AnnotationProviderWrapper, DefaultAnnotationProvider

public abstract class AnnotationProvider
extends Object
implements FacesWrapper<AnnotationProvider>

This interface provide a way to override myfaces annotation scanning algorithm that needs to be found at startup:

This is provided to allow application containers solve the following points

To override this class, create a file on a jar file with the following entry name: /META-INF/services/org.apache.myfaces.spi.AnnotationProvider and put the desired class name of the class that will override or extend the default AnnotationProvider.

To wrap the default AnnotationProvider, use a constructor like CustomAnnotationProvider(AnnotationProvider ap)

Since:
2.0.2
Author:
Leonardo Uribe

Constructor Summary
AnnotationProvider()
           
 
Method Summary
abstract  Map<Class<? extends Annotation>,Set<Class<?>>> getAnnotatedClasses(ExternalContext ctx)
          Retrieve a map containing the classes that contains annotations used by jsf implementation at startup.
abstract  Set<URL> getBaseUrls()
          Deprecated.  
 Set<URL> getBaseUrls(ExternalContext ctx)
          Same as getBaseUrls(), but with the ExternalContext reference.
 AnnotationProvider getWrapped()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationProvider

public AnnotationProvider()
Method Detail

getAnnotatedClasses

public abstract Map<Class<? extends Annotation>,Set<Class<?>>> getAnnotatedClasses(ExternalContext ctx)
Retrieve a map containing the classes that contains annotations used by jsf implementation at startup.

The default implementation must comply with JSF 2.0 spec section 11.5.1 Requirements for scanning of classes for annotations.

This method could call getBaseUrls() to obtain a list of URL that could be used to indicate jar files of annotations in the classpath.

If the element in the WEB-INF/faces-config.xml file contains metadata-complete attribute whose value is "true", this method should not be called.

Parameters:
ctx - The current ExternalContext
Returns:
A map with all classes that could contain annotations.

getBaseUrls

@Deprecated
public abstract Set<URL> getBaseUrls()
                              throws IOException
Deprecated. 

The returned Set<URL> urls are calculated in this way ( see JSF 2.0 spec section 11.4.2 for definitions )

  1. All resources that match either "META-INF/faces-config.xml" or end with ".facesconfig.xml" directly in the "META-INF" directory (considered applicationConfigurationResources)

Returns:
Throws:
IOException

getBaseUrls

public Set<URL> getBaseUrls(ExternalContext ctx)
                     throws IOException
Same as getBaseUrls(), but with the ExternalContext reference. By default it calls to getBaseUrls()

Parameters:
ctx -
Returns:
Throws:
IOException
Since:
2.1.9, 2.0.15

getWrapped

public AnnotationProvider getWrapped()
Specified by:
getWrapped in interface FacesWrapper<AnnotationProvider>


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.