Package me.a8kj.config.context.impl
Class BasicConfigExecutionContext<K>
java.lang.Object
me.a8kj.config.context.impl.BasicConfigExecutionContext<K>
- All Implemented Interfaces:
ConfigExecutionContext<K>
Standard implementation of
ConfigExecutionContext.
Bridges the gap between the file, the executor, and the CRUD operations.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfig()Retrieves the underlying configuration file.execute(Function<CRUDOperations<K>, ConfigOperation<K>> task) Executes a specific operation within this context.static <K> ConfigExecutionContext<K> of(String configKey, CRUDOperations<K> operations) Static factory to create a context from a registered config key.Retrieves the operations handler (operator) used by this context.
-
Constructor Details
-
BasicConfigExecutionContext
public BasicConfigExecutionContext()
-
-
Method Details
-
of
Static factory to create a context from a registered config key. -
execute
public ConfigExecutionContext<K> execute(Function<CRUDOperations<K>, ConfigOperation<K>> task) throws IOExceptionDescription copied from interface:ConfigExecutionContextExecutes a specific operation within this context.- Specified by:
executein interfaceConfigExecutionContext<K>- Parameters:
task- a function that provides the operation from the available CRUD operations.- Returns:
- the current context for chaining.
- Throws:
IOException- if the execution fails.
-
config
Description copied from interface:ConfigExecutionContextRetrieves the underlying configuration file.- Specified by:
configin interfaceConfigExecutionContext<K>- Returns:
- the
ConfigFileinstance.
-
operations
Description copied from interface:ConfigExecutionContextRetrieves the operations handler (operator) used by this context.- Specified by:
operationsin interfaceConfigExecutionContext<K>- Returns:
- the
CRUDOperationsinstance.
-