Skip to content

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.

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.

ReturnsSignatureSummary
voidregister(IAssetLocator locator) staticAdds a locator in front of the others; registering it again moves it to the front.
voidunregister(IAssetLocator locator) staticRemoves a locator, a built-in one included.
booleansupports(Object handle) staticIf true, handle is an Asset or a registered locator supports it.
Assetlocate(Object handle) staticReturns handle when it is an asset, otherwise the asset of the first locator that supports it.

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

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

Report a problem with this page