Top Description Inners Fields Constructors Methods
javax.faces.view.facelets

public abstract Class FaceletCache<V>

extends Object
Class Inheritance
Imports
java.io.IOException, java.net.URL

This API defines the facility by which the Facelets javax.faces.view.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 and isFaceletCached methods. The latter is a special kind of Facelet that corresponds to javax.faces.view.ViewDeclarationLanguage#getViewMetadata. This kind of Facelet is accessed via the getViewMetadataFacelet and isViewMetadataFaceletCached methods.

Since
2.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
FaceletCache.MemberFactory<V>

Factory interface for creating Facelet or View Metadata Facelet instances.

Field Summary

Modifier and TypeField and Description
private FaceletCache.MemberFactory<V>
private FaceletCache.MemberFactory<V>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract V

Returns:

a cached or new Facelet
getFacelet
(URL
URL for the Facelet being retrieved
url
)

Returns a cached Facelet instance.

protected FaceletCache.MemberFactory<V>

Returns:

the MemberFactory passed to setMemberFactories for the purpose of creating Facelet instance.
getMemberFactory
()

Returns the MemberFactory passed to setMemberFactories for the purpose of creating Facelet instance.

protected FaceletCache.MemberFactory<V>

Returns:

the MemberFactory passed to setMemberFactories for the purpose of creating View Metadata Facelet instance.
getMetadataMemberFactory
()

Returns the MemberFactory passed to setMemberFactories for the purpose of creating View Metadata Facelet instance.

public abstract V

Returns:

a cached or new View Metadata Facelet instance
getViewMetadataFacelet
(URL
URL for the View Metadata Facelet being retrieved
url
)

Returns a cached View Metadata Facelet instance.

public abstract boolean

Returns:

true if a cached instance exists, false otherwise
isFaceletCached
(URL
URL for the Facelet
url
)

Determines whether a cached Facelet instance exists for this URL.

public abstract boolean

Returns:

true if a cached instance exists, false otherwise
isViewMetadataFaceletCached
(URL
URL for the View Metadata Facelet
url
)

Determines whether a cached View Metadata Facelet instance exists for this URL.

public void
setCacheFactories(FaceletCache.MemberFactory<V>
the MemberFactory instance that will be used to create instances of Facelets.
faceletFactory
,
FaceletCache.MemberFactory<V>
the MemberFactory instance that will be used to create instances of metadata Facelets.
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 MemberFactory instances that will be used to create instances of Facelets and View Metadata Facelets.

protected void
setMemberFactories(FaceletCache.MemberFactory<V>
the MemberFactory instance that will be used to create instances of Facelets.
faceletFactory
,
FaceletCache.MemberFactory<V>
the MemberFactory instance that will be used to create instances of metadata Facelets.
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 the MemberFactory instances that will be used to create instances of Facelets and View Metadata Facelets.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

memberFactoryback to summary
private FaceletCache.MemberFactory<V> memberFactory
viewMetadataMemberFactoryback to summary
private FaceletCache.MemberFactory<V> viewMetadataMemberFactory

Constructor Detail

FaceletCacheback to summary
public FaceletCache()

Method Detail

getFaceletback to summary
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 MemberFactory and stored in the cache.

Parameters
url:URL

URL for the Facelet being retrieved

Returns:V

a cached or new Facelet

Exceptions
IOException:
if unable to load a file necessary to respond to service this method.
NullPointerException:
if argument url is null.
getMemberFactoryback to summary
protected FaceletCache.MemberFactory<V> getMemberFactory()

Returns the MemberFactory passed to setMemberFactories for the purpose of creating Facelet instance.

Returns:FaceletCache.MemberFactory<V>

the MemberFactory passed to setMemberFactories for the purpose of creating Facelet instance.

getMetadataMemberFactoryback to summary
protected FaceletCache.MemberFactory<V> getMetadataMemberFactory()

Returns the MemberFactory passed to setMemberFactories for the purpose of creating View Metadata Facelet instance.

Returns:FaceletCache.MemberFactory<V>

the MemberFactory passed to setMemberFactories for the purpose of creating View Metadata Facelet instance.

getViewMetadataFaceletback to summary
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 MemberFactory and stored in the cache.

Parameters
url:URL

URL for the View Metadata Facelet being retrieved

Returns:V

a cached or new View Metadata Facelet instance

Exceptions
IOException:
if unable to load a file necessary to respond to service this method.
NullPointerException:
if argument url is null.
isFaceletCachedback to summary
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:URL

URL for the Facelet

Returns:boolean

true if a cached instance exists, false otherwise

Exceptions
NullPointerException:
if argument url is null.
isViewMetadataFaceletCachedback to summary
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:URL

URL for the View Metadata Facelet

Returns:boolean

true if a cached instance exists, false otherwise

Exceptions
NullPointerException:
if argument url is null.
setCacheFactoriesback to summary
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 MemberFactory instances that will be used to create instances of Facelets and View Metadata Facelets. The default implementation calls through to setMemberFactories(javax.faces.view.facelets.FaceletCache.MemberFactory, javax.faces.view.facelets.FaceletCache.MemberFactory).

Parameters
faceletFactory:FaceletCache.MemberFactory<V>

the MemberFactory instance that will be used to create instances of Facelets.

viewMetadataFaceletFactory:FaceletCache.MemberFactory<V>

the MemberFactory instance that will be used to create instances of metadata Facelets.

Exceptions
NullPointerException:
if either argument is null
Since
2.3
setMemberFactoriesback to summary
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 the MemberFactory instances that will be used to create instances of Facelets and View Metadata Facelets.

Parameters
faceletFactory:FaceletCache.MemberFactory<V>

the MemberFactory instance that will be used to create instances of Facelets.

viewMetadataFaceletFactory:FaceletCache.MemberFactory<V>

the MemberFactory instance that will be used to create instances of metadata Facelets.

Annotations
@Deprecated
Exceptions
NullPointerException:
if either argument is null
javax.faces.view.facelets back to summary

public Interface FaceletCache.MemberFactory<V>


Factory interface for creating Facelet or View Metadata Facelet instances.

Method Summary

Modifier and TypeMethod and Description
public V

Returns:

the newly created Facelet or View Metadata Facelet
newInstance
(final URL
the URL that will be used as the key for the instance being created.
key
)

Create a Facelet or View Metadata Facelet (depending on the type of factory this is) for the argument URL.

Method Detail

newInstanceback to summary
public V newInstance(final URL key) throws IOException

Create a Facelet or View Metadata Facelet (depending on the type of factory this is) for the argument URL.

Parameters
key:URL

the URL that will be used as the key for the instance being created.

Returns:V

the newly created Facelet or View Metadata Facelet

Exceptions
IOException:
if unable to load a file necessary to respond to service this method.
NullPointerException:
if argument key is null.