Interface CompileState<S>


  • public interface CompileState<S>
    Provides compiler state to an object.
    Author:
    Daniel Sagenschneider
    • Field Detail

      • compileState

        static final java.lang.ThreadLocal<java.util.Map<java.lang.Class<?>,​java.lang.Object>> compileState
        Registry of state.
    • 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 the CompileRunnable 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 the CompileSupplier 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
      • mergeCompileContext

        default S mergeCompileContext​(S outer,
                                      S inner)
        Enables merging state when additional inner context is run.
        Parameters:
        outer - Outer state.
        inner - Inner state.
        Returns:
        Merged state.