Class WebResourcePackageManager
java.lang.Object
com.foreach.across.modules.web.resource.WebResourcePackageManager
Allows registration of
WebResourcePackage instances under a specific name.
When attached to a WebResourceRegistry, the caller can simply do WebResourceRegistry.addPackage(String...)
to install all resources bundled by the specific package.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanextendPackage(@NonNull String name, @NonNull WebResourcePackage extension) Extend the package registered under the current name with the given package.booleanextendPackage(@NonNull String name, @NonNull Collection<WebResourceRule> rules) Extend the package registered under the current name with the given web resource rules.booleanextendPackage(@NonNull String name, WebResourceRule... rules) Extend the package registered under the current name with the given web resource rules.getPackage(@NonNull String name) Get the package with the given name.voidregister(@NonNull String name, @NonNull WebResourcePackage webResourcePackage) unregister(@NonNull String name) Remove a package.
-
Constructor Details
-
WebResourcePackageManager
public WebResourcePackageManager()
-
-
Method Details
-
register
public void register(@NonNull @NonNull String name, @NonNull @NonNull WebResourcePackage webResourcePackage) -
getPackageNames
- Returns:
- names of the registered packages
-
unregister
Remove a package.- Parameters:
name- of the package to remove- Returns:
- package that has been removed
-
getPackage
Get the package with the given name.- Parameters:
name- of the package- Returns:
- resource package
-
extendPackage
Extend the package registered under the current name with the given web resource rules. The rules will be bundled into a separate package and then combined with the original usingWebResourcePackage.combine(WebResourcePackage, WebResourcePackage). The result will be registered under the original packaga name.If the package with that name is not present to begin with, nothing will be done and
falsewill be returned.- Parameters:
name- of the package to extendrules- to append to the package- Returns:
- true if the package was present and has been extended, false if the package was not found and no changes have been made
-
extendPackage
public boolean extendPackage(@NonNull @NonNull String name, @NonNull @NonNull Collection<WebResourceRule> rules) Extend the package registered under the current name with the given web resource rules. The rules will be bundled into a separate package and then combined with the original usingWebResourcePackage.combine(WebResourcePackage, WebResourcePackage). The result will be registered under the original packaga name.If the package with that name is not present to begin with, nothing will be done and
falsewill be returned.- Parameters:
name- of the package to extendrules- to append to the package- Returns:
- true if the package was present and has been extended, false if the package was not found and no changes have been made
-
extendPackage
public boolean extendPackage(@NonNull @NonNull String name, @NonNull @NonNull WebResourcePackage extension) Extend the package registered under the current name with the given package. This will effectively callĀWebResourcePackage.combine(WebResourcePackage, WebResourcePackage)with both packages and register the result under the same name.If the package with that name is not present to begin with, nothing will be done and
falsewill be returned.- Parameters:
name- of the package to extendextension- to append to the package- Returns:
- true if the package was present and has been extended, false if the package was not found and no changes have been made
-