public class TweakingContext<T> extends Object
default - should init before the service and called once.
global - global scope, should be used at the system level.
thread - thread scope, should use try {tweak} finally{reset} pattern.
| Constructor and Description |
|---|
TweakingContext()
without default value
|
TweakingContext(Supplier<T> initDefault)
init with default value
|
TweakingContext(T initDefault)
init with default value
|
| Modifier and Type | Method and Description |
|---|---|
T |
current(boolean notnull)
get current value, in the order of thread, global, default value
|
T |
defaultValue(boolean notnull) |
T |
globalValue(boolean notnull) |
void |
initDefault(Supplier<T> value)
init the default value
|
void |
initDefault(T value)
init the default value
|
void |
initGlobal(Supplier<T> value)
init the default value
|
void |
initGlobal(T value)
init the default value
|
void |
initThread(Supplier<T> value)
init thread value
|
void |
initThread(T value)
init thread value
|
void |
resetGlobal()
reset global value
|
void |
resetThread()
reset thread value.
|
T |
threadValue(boolean notnull) |
void |
tweakGlobal(Supplier<T> value)
tweak global value
|
void |
tweakGlobal(T value)
tweak global value
|
void |
tweakThread(Supplier<T> value)
tweak thread value.
|
void |
tweakThread(T value)
tweak thread value.
|
public TweakingContext()
public TweakingContext(T initDefault)
public void initDefault(T value)
public void initGlobal(T value)
public void initThread(T value)
public void tweakGlobal(T value)
public void resetGlobal()
public void tweakThread(T value)
public void tweakThread(Supplier<T> value)
public void resetThread()
@Contract(value="true->!null") public T globalValue(boolean notnull)
@Contract(value="true->!null") public T threadValue(boolean notnull)
@Contract(value="true->!null") public T defaultValue(boolean notnull)
@Contract(value="true->!null") public T current(boolean notnull)
Copyright © 2024. All rights reserved.