Class CombinedResourceInfo.Builder

java.lang.Object
org.omnifaces.resourcehandler.CombinedResourceInfo.Builder
Enclosing class:
CombinedResourceInfo

public static final class CombinedResourceInfo.Builder extends Object
Use this builder to create an instance of combined resource info and put it in the cache if absent.
Author:
Bauke Scholtz
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • add

      public CombinedResourceInfo.Builder add(ResourceIdentifier resourceIdentifier)
      Add the resource represented by the given resource identifier resources of this combined resource info. The insertion order is maintained and duplicates are filtered.
      Parameters:
      resourceIdentifier - The resource identifier of the resource to be added.
      Returns:
      This builder.
    • isEmpty

      public boolean isEmpty()
      Returns true if there are no resources been added. Use this method before create() if it's unknown if there are any resources been added.
      Returns:
      True if there are no resources been added, otherwise false.
    • create

      public String create()
      Creates the CombinedResourceInfo instance in cache if absent and return its ID.
      Returns:
      The ID of the CombinedResourceInfo instance.
      Throws:
      IllegalStateException - If there are no resources been added. So, to prevent it beforehand, use the isEmpty() method to check if there are any resources been added.