Class ViewMetadata
ViewMetadata is reponsible for extracting and providing view parameter metadata from VDL views. Because
ViewDeclarationLanguage.getViewMetadata(jakarta.faces.context.FacesContext, java.lang.String) is required to return null for Jakarta Server Pages
views and non-null for views authored in Facelets for Jakarta Server Faces 2, this specification only
applies to Facelets for Jakarta Server Faces 2.
- Since:
- 2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract UIViewRootcreateMetadataView(FacesContext context) Creates a newUIViewRootcontaining 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 StringGet the view idstatic Collection<UIViewParameter>getViewParameters(UIViewRoot root) Utility method to extract view metadata from the providedUIViewRoot.static booleanhasMetadata(UIViewRoot root) Utility method to determine if the the providedUIViewRoothas metadata.
-
Constructor Details
-
ViewMetadata
public ViewMetadata()
-
-
Method Details
-
getViewId
Get the view id
- Returns:
- the view ID for which this
ViewMetadatainstance was created
-
createMetadataView
Creates a new
UIViewRootcontaining only view parameter metadata. The processing of building thisUIViewRootwith metadata should not cause any events to be published to the application. The implementation must callFacesContext.setProcessingEvents(boolean)passingfalseas the argument, at the beginning of the method, and passtrueto 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
UIImportConstantsmust be processed after applying the tag handlers.
- Parameters:
context- theFacesContextfor the current request- Returns:
- a
UIViewRootcontaining only view parameter metadata (if any)
-
getViewParameters
Utility method to extract view metadata from the provided
UIViewRoot.- Parameters:
root- theUIViewRootfrom which the metadata will be extracted.- Returns:
- a
CollectionofUIViewParameterinstances. If the view has no metadata, the collection will be empty.
-
getViewActions
Utility method to extract view metadata from the provided
UIViewRoot.- Parameters:
root- theUIViewRootfrom which the metadata will be extracted.- Returns:
- a
CollectionofUIViewActioninstances. If the view has no metadata, the collection will be empty.
-
getImportConstants
Utility method to extract view metadata from the provided
UIViewRoot.- Parameters:
root- TheUIViewRootfrom which the metadata will be extracted.- Returns:
- A
CollectionofUIImportConstantsinstances. If the view has no metadata, the collection will be empty.
-
hasMetadata
Utility method to determine if the the provided
UIViewRoothas metadata. The default implementation will return true if the providedUIViewRoothas a facet namedUIViewRoot.METADATA_FACET_NAMEand that facet has children. It will return false otherwise.- Parameters:
root- theUIViewRootfrom which the metadata will be extracted from- Returns:
- true if the view has metadata, false otherwise.
-