public class FunctionInitializer extends Object implements Closeable, AutoCloseable
| Modifier and Type | Class and Description |
|---|---|
class |
FunctionInitializer.ParseContext
The parse context supplied from the
run(String[], Function) method. |
| Modifier and Type | Field and Description |
|---|---|
protected ApplicationContext |
applicationContext
The current
ApplicationContext. |
protected boolean |
closeContext |
| Modifier | Constructor and Description |
|---|---|
|
FunctionInitializer()
Constructor.
|
protected |
FunctionInitializer(ApplicationContext applicationContext)
Start a function for an existing
ApplicationContext. |
protected |
FunctionInitializer(ApplicationContext applicationContext,
boolean inject)
Start a function for an existing
ApplicationContext. |
| Modifier and Type | Method and Description |
|---|---|
protected ApplicationContext |
buildApplicationContext(C context) |
void |
close() |
protected void |
injectThis(ApplicationContext applicationContext)
Injects this instance.
|
protected ApplicationContextBuilder |
newApplicationContextBuilder()
Builds a new builder.
|
protected ExecutableMethod<Object,Object> |
resolveFunction(LocalFunctionRegistry localFunctionRegistry,
String functionName)
Resolve a function from the
LocalFunctionRegistry. |
protected String |
resolveFunctionName(Environment env)
Resolves the function name to execution for the environment.
|
void |
run(String[] args,
Function<FunctionInitializer.ParseContext,?> supplier)
This method is designed to be called when using the
FunctionInitializer from a static Application main method. |
protected Environment |
startEnvironment(ApplicationContext applicationContext)
Start the environment specified.
|
protected void |
startThis(ApplicationContext applicationContext)
Start this environment.
|
protected final boolean closeContext
protected ApplicationContext applicationContext
ApplicationContext.public FunctionInitializer()
protected FunctionInitializer(ApplicationContext applicationContext)
ApplicationContext.applicationContext - The application contextprotected FunctionInitializer(ApplicationContext applicationContext, boolean inject)
ApplicationContext.applicationContext - The application contextinject - inject this into the application flag@Internal public void close() throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void run(String[] args, Function<FunctionInitializer.ParseContext,?> supplier) throws IOException
FunctionInitializer from a static Application main method.args - The arguments passed to mainsupplier - The function that executes this functionIOException - If an error occursprotected void startThis(ApplicationContext applicationContext)
applicationContext - The application contextprotected void injectThis(ApplicationContext applicationContext)
applicationContext - The ApplicationContextprotected ExecutableMethod<Object,Object> resolveFunction(LocalFunctionRegistry localFunctionRegistry, String functionName)
LocalFunctionRegistry.localFunctionRegistry - The LocalFunctionRegistryfunctionName - The function nameprotected String resolveFunctionName(Environment env)
env - The environmentprotected ApplicationContext buildApplicationContext(@Nullable C context)
context - A platform specific context objectApplicationContext to use@Nonnull protected ApplicationContextBuilder newApplicationContextBuilder()
ApplicationContextBuilderprotected Environment startEnvironment(ApplicationContext applicationContext)
applicationContext - the application context with the environment