public static class NullImplementation.NullResourceRegistry extends Object implements ResourceRegistry
ResourceRegistry implementation that does nothing.ResourceRegistry.ResourceLifecycleObserver<R>| Modifier and Type | Field and Description |
|---|---|
static NullImplementation.NullResourceRegistry |
INSTANCE
Singleton instance of a NullResourceRegistry.
|
DEFAULT_NAME| Constructor and Description |
|---|
NullResourceRegistry() |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Invoked when all resources owned by the implementer can safely be released.
|
<R> R |
getResource(Class<R> clsResource)
Attempts to retrieve the resource that was registered with the specified class.
|
<R> R |
getResource(Class<R> clsResource, String sResourceName)
Attempts to retrieve the resource that was registered with the specified class and name.
|
<R> String |
registerResource(Class<R> clzResource, Builder<? extends R> bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver<R> observer)
Registers a resource according to the specified
RegistrationBehavior. |
<R> String |
registerResource(Class<R> clzResource, R resource)
Registers the resource for later retrieval with
ResourceResolver.getResource(Class). |
<R> String |
registerResource(Class<R> clzResource, String sResourceName, Builder<? extends R> bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver<R> observer)
Registers a resource according to the specified
RegistrationBehavior. |
<R> String |
registerResource(Class<R> clzResource, String sResourceName, R resource)
Registers the resource with the specified name for later retrieval with
ResourceResolver.getResource(Class, String). |
<R> void |
unregisterResource(Class<R> clzResource, String sResourceName)
Unregisters the resource that was previously registered of the specified class and name.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclosepublic static final NullImplementation.NullResourceRegistry INSTANCE
public <R> String registerResource(Class<R> clzResource, R resource)
ResourceRegistryResourceResolver.getResource(Class).
Notes:
ResourceRegistry.registerResource(Class, String, Object)Disposable will be disposed when the ResourceRegistry is disposed.registerResource in interface ResourceRegistryclzResource - the class of the resourceresource - the resourcepublic <R> String registerResource(Class<R> clzResource, String sResourceName, R resource)
ResourceRegistryResourceResolver.getResource(Class, String).
Notes:
Disposable will be disposed when the ResourceRegistry is disposed.registerResource in interface ResourceRegistryclzResource - the class of the resourcesResourceName - the proposed name of the resourceresource - the resourcepublic <R> String registerResource(Class<R> clzResource, Builder<? extends R> bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver<R> observer)
ResourceRegistryRegistrationBehavior. If successful the registered resource may later be retrieved using method ResourceResolver.getResource(Class).
Notes:
ResourceRegistry.registerResource(Class, String, Builder, RegistrationBehavior, ResourceLifecycleObserver)Disposable will be disposed when the ResourceRegistry is disposed.registerResource in interface ResourceRegistryR - the type of the resourceclzResource - the class of the resourcebldrResource - the Builder to realize the resource to register (if required the specified behavior requires a resource)behavior - the RegistrationBehavior to useobserver - an optional ResourceRegistry.ResourceLifecycleObserver that will be called when the resource is being released from the ResourceRegistry (may be null)public <R> String registerResource(Class<R> clzResource, String sResourceName, Builder<? extends R> bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver<R> observer) throws IllegalArgumentException
ResourceRegistryRegistrationBehavior. If successful the registered resource may later be retrieved using method ResourceResolver.getResource(Class, String).
Notes:
Disposable will be disposed when the ResourceRegistry is disposed.registerResource in interface ResourceRegistryR - the type of the resourceclzResource - the class of the resourcesResourceName - the proposed name of the resourcebldrResource - the Builder to realize the resource to register (if required the specified behavior requires a resource)behavior - the RegistrationBehavior to useobserver - an optional ResourceRegistry.ResourceLifecycleObserver that will be called when the resource is being released from the ResourceRegistry (may be null)IllegalArgumentException - if a resource with the specified class is already registered with the ResourceRegistry and the behavior was RegistrationBehavior.FAILpublic <R> void unregisterResource(Class<R> clzResource, String sResourceName)
ResourceRegistryNote: Unregistering a resource does not cause it to be disposed, but it does call ResourceRegistry.ResourceLifecycleObserver.onRelease(Object) if an observer was provided at the time of registration.
unregisterResource in interface ResourceRegistryR - the type of the resourceclzResource - the class of the resourcesResourceName - the name of the resourcepublic <R> R getResource(Class<R> clsResource)
ResourceResolvergetResource in interface ResourceResolverR - the type of the resourceclsResource - the class of the resourcenull if the resource is unknown to the ResourceRegistrypublic <R> R getResource(Class<R> clsResource, String sResourceName)
ResourceResolvergetResource in interface ResourceResolverR - the type of the resourceclsResource - the class of the resourcesResourceName - the name of the resourcenull if the resource is unknown to the ResourceRegistrypublic void dispose()
DisposableOnce disposed of the object should no longer be considered to be usable.
Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.
dispose in interface Disposable