AssetLocator
final class AssetLocator
Package: dev.joid.lib.asset.locator · Module: core · Source: AssetLocator.java
The registry of the asset locators, which turns any input into an Asset.
Description
Section titled “Description”JOID registers three locators, for a File, a String and an InputStream; register your own to accept another kind of input, such as an id of your application.
The last registered locator is asked first.
Learn more
Section titled “Learn more”Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
void | register(IAssetLocator locator) static | Adds a locator in front of the others; registering it again moves it to the front. |
void | unregister(IAssetLocator locator) static | Removes a locator, a built-in one included. |
boolean | supports(Object handle) static | If true, handle is an Asset or a registered locator supports it. |
Asset | locate(Object handle) static | Returns handle when it is an asset, otherwise the asset of the first locator that supports it. |
Method details
Section titled “Method details”register
Section titled “register”void register(IAssetLocator locator) static
Adds a locator in front of the others; registering it again moves it to the front.
unregister
Section titled “unregister”void unregister(IAssetLocator locator) static
Removes a locator, a built-in one included.
supports
Section titled “supports”boolean supports(Object handle) static
If true, handle is an Asset or a registered locator supports it.
locate
Section titled “locate”Asset locate(Object handle) static
Throws:
IllegalArgumentException: No asset locator knows the input … of type …, register an IAssetLocator that supports it with AssetLocator.register(…)
Returns handle when it is an asset, otherwise the asset of the first locator that supports it.
Throws IllegalArgumentException when no locator supports it.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
