Class ViewMetadata
- java.lang.Object
-
- jakarta.faces.view.ViewMetadata
-
public abstract class ViewMetadata extends Object
ViewMetadata
is reponsible for extracting and providing view parameter metadata from VDL views. BecauseViewDeclarationLanguage.getViewMetadata(jakarta.faces.context.FacesContext, java.lang.String)
is required to returnnull
for Jakarta Server Pages views and non-null
for views authored in Facelets for Jakarta Faces 2, this specification only applies to Facelets for Jakarta Faces 2.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description ViewMetadata()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract UIViewRoot
createMetadataView(FacesContext context)
Creates a newUIViewRoot
containing only view parameter metadata.static Collection<UIImportConstants>
getImportConstants(UIViewRoot root)
Utility method to extract view metadata from the providedUIViewRoot
.static Collection<UIViewAction>
getViewActions(UIViewRoot root)
Utility method to extract view metadata from the providedUIViewRoot
.abstract String
getViewId()
Get the view idstatic Collection<UIViewParameter>
getViewParameters(UIViewRoot root)
Utility method to extract view metadata from the providedUIViewRoot
.static boolean
hasMetadata(UIViewRoot root)
Utility method to determine if the the providedUIViewRoot
has metadata.
-
-
-
Method Detail
-
getViewId
public abstract String getViewId()
Get the view id
- Returns:
- the view ID for which this
ViewMetadata
instance was created
-
createMetadataView
public abstract UIViewRoot createMetadataView(FacesContext context)
Creates a new
UIViewRoot
containing only view parameter metadata. The processing of building thisUIViewRoot
with metadata should not cause any events to be published to the application. The implementation must callFacesContext.setProcessingEvents(boolean)
passingfalse
as the argument, at the beginning of the method, and passtrue
to the same method at the end. The implementation must ensure that this happens regardless of ant exceptions that may be thrown.Take note a compliant implementation has to ensure that:
- the new UIViewRoot must be set as the FacesContext's viewRoot before applying the tag handlers, restoring the old FacesContext in a finally block.
- The contents of the current UIViewRoot's ViewMap must be copied to the ViewMap of the new UIViewRoot before applying the tag handlers.
- The
UIImportConstants
must be processed after applying the tag handlers.
- Parameters:
context
- theFacesContext
for the current request- Returns:
- a
UIViewRoot
containing only view parameter metadata (if any)
-
getViewParameters
public static Collection<UIViewParameter> getViewParameters(UIViewRoot root)
Utility method to extract view metadata from the provided
UIViewRoot
.- Parameters:
root
- theUIViewRoot
from which the metadata will be extracted.- Returns:
- a
Collection
ofUIViewParameter
instances. If the view has no metadata, the collection will be empty.
-
getViewActions
public static Collection<UIViewAction> getViewActions(UIViewRoot root)
Utility method to extract view metadata from the provided
UIViewRoot
.- Parameters:
root
- theUIViewRoot
from which the metadata will be extracted.- Returns:
- a
Collection
ofUIViewAction
instances. If the view has no metadata, the collection will be empty.
-
getImportConstants
public static Collection<UIImportConstants> getImportConstants(UIViewRoot root)
Utility method to extract view metadata from the provided
UIViewRoot
.- Parameters:
root
- TheUIViewRoot
from which the metadata will be extracted.- Returns:
- A
Collection
ofUIImportConstants
instances. If the view has no metadata, the collection will be empty.
-
hasMetadata
public static boolean hasMetadata(UIViewRoot root)
Utility method to determine if the the provided
UIViewRoot
has metadata. The default implementation will return true if the providedUIViewRoot
has a facet namedUIViewRoot.METADATA_FACET_NAME
and that facet has children. It will return false otherwise.- Parameters:
root
- theUIViewRoot
from which the metadata will be extracted from- Returns:
- true if the view has metadata, false otherwise.
-
-