Class FaceletCache<V>
- java.lang.Object
-
- jakarta.faces.view.facelets.FaceletCache<V>
-
public abstract class FaceletCache<V> extends Object
This API defines the facility by which the Facelets
ViewDeclarationLanguagecreates and caches instances of Facelets.The cache handles two different kinds of Facelets: View Facelets and View Metadata Facelets. The former is the usual Facelet that provides for the construction of a
UIComponenttree. This kind of Facelet is accessed via thegetFacelet(java.net.URL)andisFaceletCached(java.net.URL)methods. The latter is a special kind of Facelet that corresponds toViewDeclarationLanguage.getViewMetadata(jakarta.faces.context.FacesContext, java.lang.String). This kind of Facelet is accessed via thegetViewMetadataFacelet(java.net.URL)andisViewMetadataFaceletCached(java.net.URL)methods.- Since:
- 2.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceFaceletCache.MemberFactory<V>Factory interface for creating Facelet or View Metadata Facelet instances.
-
Constructor Summary
Constructors Constructor Description FaceletCache()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract VgetFacelet(URL url)Returns a cached Facelet instance.protected FaceletCache.MemberFactory<V>getMemberFactory()Returns theFaceletCache.MemberFactorypassed tosetCacheFactories(jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>, jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>)for the purpose of creating Facelet instance.protected FaceletCache.MemberFactory<V>getMetadataMemberFactory()Returns theFaceletCache.MemberFactorypassed tosetCacheFactories(jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>, jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>)for the purpose of creating View Metadata Facelet instance.abstract VgetViewMetadataFacelet(URL url)Returns a cached View Metadata Facelet instance.abstract booleanisFaceletCached(URL url)Determines whether a cached Facelet instance exists for this URL.abstract booleanisViewMetadataFaceletCached(URL url)Determines whether a cached View Metadata Facelet instance exists for this URL.voidsetCacheFactories(FaceletCache.MemberFactory<V> faceletFactory, FaceletCache.MemberFactory<V> viewMetadataFaceletFactory)This must be called by the runtime at startup time, before any requests are serviced, and allows for theFaceletCacheimplementation to provide theFaceletCache.MemberFactoryinstances that will be used to create instances of Facelets and View Metadata Facelets.
-
-
-
Method Detail
-
getFacelet
public abstract V getFacelet(URL url) throws IOException
Returns a cached Facelet instance. If no instance is available, it will be created using the Facelet
FaceletCache.MemberFactoryand stored in the cache.- Parameters:
url-URLfor the Facelet being retrieved- Returns:
- a cached or new
Facelet - Throws:
NullPointerException- if argumenturlisnull.IOException- if unable to load a file necessary to respond to service this method.
-
isFaceletCached
public abstract boolean isFaceletCached(URL url)
Determines whether a cached Facelet instance exists for this URL. Returns true if a cached instance exists, false otherwise
- Parameters:
url-URLfor the Facelet- Returns:
- true if a cached instance exists, false otherwise
- Throws:
NullPointerException- if argumenturlisnull.
-
getViewMetadataFacelet
public abstract V getViewMetadataFacelet(URL url) throws IOException
Returns a cached View Metadata Facelet instance. If no instance is available, it will be created using the View Metadata Facelet
FaceletCache.MemberFactoryand stored in the cache.- Parameters:
url-URLfor the View Metadata Facelet being retrieved- Returns:
- a cached or new View Metadata
Faceletinstance - Throws:
NullPointerException- if argumenturlisnull.IOException- if unable to load a file necessary to respond to service this method.
-
isViewMetadataFaceletCached
public abstract boolean isViewMetadataFaceletCached(URL url)
Determines whether a cached View Metadata Facelet instance exists for this URL. Returns true if a cached instance exists, false otherwise
- Parameters:
url-URLfor the View Metadata Facelet- Returns:
- true if a cached instance exists, false otherwise
- Throws:
NullPointerException- if argumenturlisnull.
-
setCacheFactories
public void setCacheFactories(FaceletCache.MemberFactory<V> faceletFactory, FaceletCache.MemberFactory<V> viewMetadataFaceletFactory)
This must be called by the runtime at startup time, before any requests are serviced, and allows for the
FaceletCacheimplementation to provide theFaceletCache.MemberFactoryinstances that will be used to create instances of Facelets and View Metadata Facelets.- Parameters:
faceletFactory- theFaceletCache.MemberFactoryinstance that will be used to create instances of Facelets.viewMetadataFaceletFactory- theFaceletCache.MemberFactoryinstance that will be used to create instances of metadata Facelets.- Throws:
NullPointerException- if either argument isnull- Since:
- 2.3
-
getMemberFactory
protected FaceletCache.MemberFactory<V> getMemberFactory()
Returns the
FaceletCache.MemberFactorypassed tosetCacheFactories(jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>, jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>)for the purpose of creating Facelet instance.- Returns:
- the
FaceletCache.MemberFactorypassed tosetCacheFactories(jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>, jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>)for the purpose of creating Facelet instance.
-
getMetadataMemberFactory
protected FaceletCache.MemberFactory<V> getMetadataMemberFactory()
Returns the
FaceletCache.MemberFactorypassed tosetCacheFactories(jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>, jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>)for the purpose of creating View Metadata Facelet instance.- Returns:
- the
FaceletCache.MemberFactorypassed tosetCacheFactories(jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>, jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>)for the purpose of creating View Metadata Facelet instance.
-
-