javax.faces.view.facelets

## Class FaceletCache<V>

- java.lang.Object
- - javax.faces.view.facelets.FaceletCache<V>

-     public abstract class FaceletCache<V>
      extends 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(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

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `FaceletCache.MemberFactory<V>` Factory interface for creating Facelet or View Metadata Facelet instances.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FaceletCache()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract V` | `getFacelet(URL url)` Returns a cached Facelet instance.
    `protected FaceletCache.MemberFactory<V>` | `getMemberFactory()` Returns the `FaceletCache.MemberFactory` passed to `setMemberFactories(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>` | `getMetadataMemberFactory()` Returns the `FaceletCache.MemberFactory` passed to `setMemberFactories(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` | `getViewMetadataFacelet(URL url)` Returns a cached View Metadata Facelet instance.
    `abstract boolean` | `isFaceletCached(URL url)` Determines whether a cached Facelet instance exists for this URL.
    `abstract boolean` | `isViewMetadataFaceletCached(URL url)` Determines whether a cached View Metadata Facelet instance exists for this URL.
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FaceletCache

          public FaceletCache()

  - ### 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.MemberFactory` and stored in the cache.

      Parameters:
        `url` - `URL` for the Facelet being retrieved
      Throws:
        `NullPointerException` - if argument `url` is `null`.
        `IOException`

    - #### 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` - `URL` for the Facelet
      Throws:
        `NullPointerException` - if argument `url` is `null`.

    - #### 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.MemberFactory` and stored in the cache.

      Parameters:
        `url` - `URL` for the View Metadata Facelet being retrieved
      Throws:
        `NullPointerException` - if argument `url` is `null`.
        `IOException`

    - #### 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` - `URL` for the View Metadata Facelet
      Throws:
        `NullPointerException` - if argument `url` is `null`.

    - #### setMemberFactories

          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.

      Parameters:
        `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.
      Throws:
        `NullPointerException` - if either argument is `null`

    - #### getMemberFactory

          protected FaceletCache.MemberFactory<V> getMemberFactory()

      Returns the `FaceletCache.MemberFactory` passed to `setMemberFactories(javax.faces.view.facelets.FaceletCache.MemberFactory<V>, javax.faces.view.facelets.FaceletCache.MemberFactory<V>)` for the purpose of creating Facelet instance.

    - #### getMetadataMemberFactory

          protected FaceletCache.MemberFactory<V> getMetadataMemberFactory()

      Returns the `FaceletCache.MemberFactory` passed to `setMemberFactories(javax.faces.view.facelets.FaceletCache.MemberFactory<V>, javax.faces.view.facelets.FaceletCache.MemberFactory<V>)` for the purpose of creating View Metadata Facelet instance.

Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.