public class FunctionInitializer
extends java.lang.Object
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() |
ApplicationContext |
getApplicationContext()
Resolves the
ApplicationContext for this class. |
protected void |
injectThis(ApplicationContext applicationContext)
Injects this instance.
|
protected ApplicationContextBuilder |
newApplicationContextBuilder()
Builds a new builder.
|
protected ExecutableMethod<java.lang.Object,java.lang.Object> |
resolveFunction(LocalFunctionRegistry localFunctionRegistry,
java.lang.String functionName)
Resolve a function from the
LocalFunctionRegistry . |
protected java.lang.String |
resolveFunctionName(Environment env)
Resolves the function name to execution for the environment.
|
void |
run(java.lang.String[] args,
java.util.function.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 java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public void run(java.lang.String[] args, java.util.function.Function<FunctionInitializer.ParseContext,?> supplier) throws java.io.IOException
FunctionInitializer
from a static Application main method.args
- The arguments passed to mainsupplier
- The function that executes this functionjava.io.IOException
- If an error occursprotected void startThis(ApplicationContext applicationContext)
applicationContext
- The application contextprotected void injectThis(ApplicationContext applicationContext)
applicationContext
- The ApplicationContext
protected ExecutableMethod<java.lang.Object,java.lang.Object> resolveFunction(LocalFunctionRegistry localFunctionRegistry, java.lang.String functionName)
LocalFunctionRegistry
.localFunctionRegistry
- The LocalFunctionRegistry
functionName
- The function nameprotected java.lang.String resolveFunctionName(Environment env)
env
- The environmentprotected ApplicationContext buildApplicationContext(@Nullable C context)
context
- A platform specific context objectApplicationContext
to use@NonNull protected ApplicationContextBuilder newApplicationContextBuilder()
ApplicationContextBuilder
protected Environment startEnvironment(ApplicationContext applicationContext)
applicationContext
- the application context with the environmentpublic ApplicationContext getApplicationContext()
ApplicationContextProvider
ApplicationContext
for this class.getApplicationContext
in interface ApplicationContextProvider
ApplicationContext