Interface ReloadShell<C>
- Type Parameters:
C- the type of the config
This handler provides a proxy, called the shell (getShell()) which delegates all calls made on it to an
inner delegate. The delegate can also be set or get via this interface. If the current delegate is null,
calls to methods on the shell will throw NullPointerException.
-
Method Summary
Modifier and TypeMethodDescription@Nullable CGets the current inner delegate@NonNull CgetShell()Gets the configuration shell, a proxy to the current delegate.voidsetCurrentDelegate(@Nullable C delegate) Sets the inner configuration object to the provided value.
-
Method Details
-
setCurrentDelegate
Sets the inner configuration object to the provided value.This function is thread safe; the assignment is performed with at least acquire/release semantics.
- Parameters:
delegate- the delegate value- Throws:
IllegalArgumentException- if the argument todelegateis the shell itself, or creates a cycle (such as with otherReloadShells) pointing to the shell
-
getCurrentDelegate
@Nullable C getCurrentDelegate()Gets the current inner delegate- Returns:
- the delegate value
-
getShell
@NonNull C getShell()Gets the configuration shell, a proxy to the current delegate.Methods called on it will reflect the latest state of the configuration (set with
setCurrentDelegate(Object)) at the time of the method call. Thus, the proxy acts as convenient wrapper that automatically returns up-to-date values.This means the shell itself (the returned value) can be conveniently stored in multiple locations, without needing to update these fields when the underlying configuration (the delegate) is reloaded.
- Returns:
- the configuration shell, a proxy to the current delegate
-