public abstract class FaceletCache<V>
extends java.lang.Object
This API defines the facility by which the Facelets
ViewDeclarationLanguage
creates 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 UIComponent
tree. This kind of Facelet is accessed via
the getFacelet(java.net.URL)
and isFaceletCached(java.net.URL)
methods. The latter is a special kind of Facelet that
corresponds to ViewDeclarationLanguage.getViewMetadata(jakarta.faces.context.FacesContext, java.lang.String)
. This kind of Facelet is accessed
via the getViewMetadataFacelet(java.net.URL)
and isViewMetadataFaceletCached(java.net.URL)
methods.
Modifier and Type | Class and Description |
---|---|
static interface |
FaceletCache.MemberFactory<V>
Factory interface for creating Facelet or View Metadata Facelet instances. |
Constructor and Description |
---|
FaceletCache() |
Modifier and Type | Method and Description |
---|---|
abstract V |
getFacelet(java.net.URL url)
Returns a cached Facelet instance. |
protected FaceletCache.MemberFactory<V> |
getMemberFactory()
Returns the |
protected FaceletCache.MemberFactory<V> |
getMetadataMemberFactory()
Returns the |
abstract V |
getViewMetadataFacelet(java.net.URL url)
Returns a cached View Metadata Facelet instance. |
abstract boolean |
isFaceletCached(java.net.URL url)
Determines whether a cached Facelet instance exists for this URL. |
abstract boolean |
isViewMetadataFaceletCached(java.net.URL url)
Determines whether a cached View Metadata Facelet instance exists for this URL. |
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
|
protected void |
setMemberFactories(FaceletCache.MemberFactory<V> faceletFactory,
FaceletCache.MemberFactory<V> viewMetadataFaceletFactory)
Deprecated.
|
public abstract V getFacelet(java.net.URL url) throws java.io.IOException
Returns a cached Facelet instance. If no instance is available, it will be created using the Facelet
FaceletCache.MemberFactory
and stored in the cache.
url
- URL
for the Facelet being retrievedFacelet
java.lang.NullPointerException
- if argument url
is null
.java.io.IOException
- if unable to load a file necessary to respond to service this method.public abstract boolean isFaceletCached(java.net.URL url)
Determines whether a cached Facelet instance exists for this URL. Returns true if a cached instance exists, false otherwise
url
- URL
for the Faceletjava.lang.NullPointerException
- if argument url
is null
.public abstract V getViewMetadataFacelet(java.net.URL url) throws java.io.IOException
Returns a cached View Metadata Facelet instance. If no instance is available, it will be created using the View
Metadata Facelet FaceletCache.MemberFactory
and stored in the cache.
url
- URL
for the View Metadata Facelet being retrievedFacelet
instancejava.lang.NullPointerException
- if argument url
is null
.java.io.IOException
- if unable to load a file necessary to respond to service this method.public abstract boolean isViewMetadataFaceletCached(java.net.URL url)
Determines whether a cached View Metadata Facelet instance exists for this URL. Returns true if a cached instance exists, false otherwise
url
- URL
for the View Metadata Faceletjava.lang.NullPointerException
- if argument url
is null
.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
FaceletCache
implementation to provide the FaceletCache.MemberFactory
instances that will be used to create
instances of Facelets and View Metadata Facelets. The default implementation calls through to
setMemberFactories(jakarta.faces.view.facelets.FaceletCache.MemberFactory, jakarta.faces.view.facelets.FaceletCache.MemberFactory)
.
faceletFactory
- the FaceletCache.MemberFactory
instance that will be used to create instances of Facelets.viewMetadataFaceletFactory
- the FaceletCache.MemberFactory
instance that will be used to create instances of
metadata Facelets.java.lang.NullPointerException
- if either argument is null
@Deprecated protected void setMemberFactories(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
FaceletCache
implementation to provide the FaceletCache.MemberFactory
instances that will be used to create
instances of Facelets and View Metadata Facelets.
faceletFactory
- the FaceletCache.MemberFactory
instance that will be used to create instances of Facelets.viewMetadataFaceletFactory
- the FaceletCache.MemberFactory
instance that will be used to create instances of
metadata Facelets.java.lang.NullPointerException
- if either argument is null
protected FaceletCache.MemberFactory<V> getMemberFactory()
Returns the FaceletCache.MemberFactory
passed to setMemberFactories(jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>, jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>)
for the purpose of creating Facelet instance.
FaceletCache.MemberFactory
passed to setMemberFactories(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 the FaceletCache.MemberFactory
passed to setMemberFactories(jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>, jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>)
for the purpose of creating View Metadata
Facelet instance.
FaceletCache.MemberFactory
passed to setMemberFactories(jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>, jakarta.faces.view.facelets.FaceletCache.MemberFactory<V>)
for the purpose of creating View Metadata
Facelet instance.