com.liferay.faces.util.application
Interface ResourceVerifier

All Known Implementing Classes:
ResourceVerifierWrapper

public interface ResourceVerifier

This interface provides a contract for verifying whether or not a resource dependency is already satisfied.

Resource dependencies are added to the Faces view automatically when a Renderer is annotated with @ResourceDependency. They can also be added manually by calling UIViewRoot.addComponentResource(FacesContext, UIComponent) or UIViewRoot.addComponentResource(FacesContext, UIComponent, String).

In some situations, resource dependencies may already be satisfied (meaning they are guaranteed to appear on the page already, or are already provided as a resource with a different library name or resource name). When this happens it unnecessary to render the resource. For example, Liferay Portal includes Bootstrap CSS on the page automatically. It would therefore be unnecessary for Liferay Faces Alloy or BootsFaces to render a Bootstrap CSS resource. Another example would be when a developer uses BootsFaces and PrimeFaces components in the same view. Each of those component libraries add the jQuery JavaScript library as a dependency, but only one would need to be rendered.

Author:
Kyle Stiemann

Method Summary
 boolean isDependencySatisfied(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent componentResource)
          Determines whether or not a ResourceDependency represented by a UIComponent has already been satisfied.
 

Method Detail

isDependencySatisfied

boolean isDependencySatisfied(javax.faces.context.FacesContext facesContext,
                              javax.faces.component.UIComponent componentResource)
Determines whether or not a ResourceDependency represented by a UIComponent has already been satisfied.

Since the ResourceVerifier utilizes the delegation pattern, if an implementation in the delegation chain determines that a resource dependency has been satisfied, then it returns true. Otherwise it will return the value from the next member in the delegation chain. The default implementation returns false assuming that a resource dependency has not already been satisfied and therefore needs to be rendered.

Returns:
true when the resource dependency is already satisfied, otherwise false.


Copyright © 2019 Liferay, Inc.. All rights reserved.