Class MagicRuntimeConfigBinding<C, T extends AutoCloseable>
java.lang.Object
dev.ua.theroer.magicutils.bootstrap.MagicRuntimeConfigBinding<C,T>
- Type Parameters:
C- config typeT- resource type
- All Implemented Interfaces:
AutoCloseable
public final class MagicRuntimeConfigBinding<C, T extends AutoCloseable>
extends Object
implements AutoCloseable
Config-aware runtime resource binding.
The binding keeps a managed resource in sync with a config instance and rebuilds it whenever matching config sections change.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns the bound config class.current()Returns the current resource when present.booleanisClosed()Returns true when the binding has been closed.name()Returns the resource name used in the runtime registry.refresh()Rebuilds the resource from the current config instance.require()Returns the current resource or throws when absent.resource()Returns the managed resource handle.
-
Method Details
-
name
-
configClass
-
resource
Returns the managed resource handle.- Returns:
- managed resource handle
-
isClosed
public boolean isClosed()Returns true when the binding has been closed.- Returns:
- closed flag
-
current
-
require
-
refresh
Rebuilds the resource from the current config instance.- Returns:
- rebuilt resource, or null when the factory returned null
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-