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>>compileStateRegistry 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 theCompileRunnablewith the state.default <R,T extends java.lang.Throwable>
RcompileInContext(S state, CompileSupplier<R,T> logic)Runs theCompileSupplierwith the state.default SgetCompileState()Obtains the compile state.default SmergeCompileContext(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 theCompileRunnablewith 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 theCompileSupplierwith 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
-
-