Package net.officefloor.compile.state
Interface CompileState<S>
-
public interface CompileState<S>
Provides compiler state to an object.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.ThreadLocal<java.util.Map<java.lang.Class<?>,java.lang.Object>>
compileState
Registry of state.
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default <T extends java.lang.Throwable>
voidcompileInContext(S state, CompileRunnable<T> logic)
Runs theCompileRunnable
with the state.default <R,T extends java.lang.Throwable>
RcompileInContext(S state, CompileSupplier<R,T> logic)
Runs theCompileSupplier
with the state.default S
getCompileState()
Obtains the compile state.default S
mergeCompileContext(S outer, S inner)
Enables merging state when additional inner context is run.
-
-
-
Method Detail
-
getCompileState
default S getCompileState()
Obtains the compile state.- Returns:
- Compile state.
-
compileInContext
default <T extends java.lang.Throwable> void compileInContext(S state, CompileRunnable<T> logic) throws T extends java.lang.Throwable
Runs theCompileRunnable
with the state.- Type Parameters:
T
- Possible failure type.- Parameters:
state
- State.logic
-CompileRunnable
.- Throws:
T
- Possible failure.T extends java.lang.Throwable
-
compileInContext
default <R,T extends java.lang.Throwable> R compileInContext(S state, CompileSupplier<R,T> logic) throws T extends java.lang.Throwable
Runs theCompileSupplier
with the state.- Type Parameters:
R
- Return type.T
- Possible failure type.- Parameters:
state
- State.logic
-CompileSupplier
.- Returns:
- Return from
CompileSupplier
. - Throws:
T
- Possible failure.T extends java.lang.Throwable
-
-