Package net.officefloor.compile.state
Interface CompileState<S>
public interface CompileState<S>
Provides compiler state to an object.
- Author:
- Daniel Sagenschneider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ThreadLocal<Map<Class<?>,Object>> Registry of state. -
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends Throwable>
voidcompileInContext(S state, CompileRunnable<T> logic) Runs theCompileRunnablewith the state.default <R,T extends Throwable>
RcompileInContext(S state, CompileSupplier<R, T> logic) Runs theCompileSupplierwith the state.default SObtains the compile state.default SmergeCompileContext(S outer, S inner) Enables merging state when additional inner context is run.
-
Field Details
-
compileState
Registry of state.
-
-
Method Details
-
getCompileState
Obtains the compile state.- Returns:
- Compile state.
-
compileInContext
Runs theCompileRunnablewith the state.- Type Parameters:
T- Possible failure type.- Parameters:
state- State.logic-CompileRunnable.- Throws:
T- Possible failure.
-
compileInContext
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.
-
mergeCompileContext
Enables merging state when additional inner context is run.- Parameters:
outer- Outer state.inner- Inner state.- Returns:
- Merged state.
-