Class FaceletCache<V>
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(javax.faces.context.FacesContext, java.lang.String)
. This kind
of Facelet is accessed via the getViewMetadataFacelet(java.net.URL)
and
isViewMetadataFaceletCached(java.net.URL)
methods.
- Since:
- 2.1
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Factory interface for creating Facelet or View Metadata Facelet instances. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract V
getFacelet
(URL url) Returns a cached Facelet instance.protected FaceletCache.MemberFactory<V>
Returns theFaceletCache.MemberFactory
passed tosetMemberFactories(javax.faces.view.facelets.FaceletCache.MemberFactory<V>, javax.faces.view.facelets.FaceletCache.MemberFactory<V>)
for the purpose of creating Facelet instance.protected FaceletCache.MemberFactory<V>
Returns theFaceletCache.MemberFactory
passed tosetMemberFactories(javax.faces.view.facelets.FaceletCache.MemberFactory<V>, javax.faces.view.facelets.FaceletCache.MemberFactory<V>)
for the purpose of creating View Metadata Facelet instance.abstract V
Returns a cached View Metadata Facelet instance.abstract boolean
isFaceletCached
(URL url) Determines whether a cached Facelet instance exists for this URL.abstract boolean
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 theFaceletCache
implementation to provide theFaceletCache.MemberFactory
instances that will be used to create instances of Facelets and View Metadata Facelets.protected void
setMemberFactories
(FaceletCache.MemberFactory<V> faceletFactory, FaceletCache.MemberFactory<V> viewMetadataFaceletFactory) Deprecated.
-
Constructor Details
-
FaceletCache
public FaceletCache()
-
-
Method Details
-
getFacelet
Returns a cached Facelet instance. If no instance is available, it will be created using the Facelet
FaceletCache.MemberFactory
and stored in the cache.- Parameters:
url
-URL
for the Facelet being retrieved- Returns:
- a cached or new
Facelet
- Throws:
NullPointerException
- if argumenturl
isnull
.IOException
- if unable to load a file necessary to respond to service this method.
-
isFaceletCached
Determines whether a cached Facelet instance exists for this URL. Returns true if a cached instance exists, false otherwise
- Parameters:
url
-URL
for the Facelet- Returns:
- true if a cached instance exists, false otherwise
- Throws:
NullPointerException
- if argumenturl
isnull
.
-
getViewMetadataFacelet
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.- Parameters:
url
-URL
for the View Metadata Facelet being retrieved- Returns:
- a cached or new View Metadata
Facelet
instance - Throws:
NullPointerException
- if argumenturl
isnull
.IOException
- if unable to load a file necessary to respond to service this method.
-
isViewMetadataFaceletCached
Determines whether a cached View Metadata Facelet instance exists for this URL. Returns true if a cached instance exists, false otherwise
- Parameters:
url
-URL
for the View Metadata Facelet- Returns:
- true if a cached instance exists, false otherwise
- Throws:
NullPointerException
- if argumenturl
isnull
.
-
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
FaceletCache
implementation to provide theFaceletCache.MemberFactory
instances that will be used to create instances of Facelets and View Metadata Facelets. The default implementation calls through tosetMemberFactories(javax.faces.view.facelets.FaceletCache.MemberFactory, javax.faces.view.facelets.FaceletCache.MemberFactory)
.- Parameters:
faceletFactory
- theFaceletCache.MemberFactory
instance that will be used to create instances of Facelets.viewMetadataFaceletFactory
- theFaceletCache.MemberFactory
instance that will be used to create instances of metadata Facelets.- Throws:
NullPointerException
- if either argument isnull
- Since:
- 2.3
-
setMemberFactories
@Deprecated protected void setMemberFactories(FaceletCache.MemberFactory<V> faceletFactory, FaceletCache.MemberFactory<V> viewMetadataFaceletFactory) Deprecated.This must be called by the runtime at startup time, before any requests are serviced, and allows for the
FaceletCache
implementation to provide theFaceletCache.MemberFactory
instances that will be used to create instances of Facelets and View Metadata Facelets.- Parameters:
faceletFactory
- theFaceletCache.MemberFactory
instance that will be used to create instances of Facelets.viewMetadataFaceletFactory
- theFaceletCache.MemberFactory
instance that will be used to create instances of metadata Facelets.- Throws:
NullPointerException
- if either argument isnull
-
getMemberFactory
Returns the
FaceletCache.MemberFactory
passed tosetMemberFactories(javax.faces.view.facelets.FaceletCache.MemberFactory<V>, javax.faces.view.facelets.FaceletCache.MemberFactory<V>)
for the purpose of creating Facelet instance.- Returns:
- the
FaceletCache.MemberFactory
passed tosetMemberFactories(javax.faces.view.facelets.FaceletCache.MemberFactory<V>, javax.faces.view.facelets.FaceletCache.MemberFactory<V>)
for the purpose of creating Facelet instance.
-
getMetadataMemberFactory
Returns the
FaceletCache.MemberFactory
passed tosetMemberFactories(javax.faces.view.facelets.FaceletCache.MemberFactory<V>, javax.faces.view.facelets.FaceletCache.MemberFactory<V>)
for the purpose of creating View Metadata Facelet instance.- Returns:
- the
FaceletCache.MemberFactory
passed tosetMemberFactories(javax.faces.view.facelets.FaceletCache.MemberFactory<V>, javax.faces.view.facelets.FaceletCache.MemberFactory<V>)
for the purpose of creating View Metadata Facelet instance.
-