Package io.micronaut.function.executor
Class FunctionInitializer
java.lang.Object
io.micronaut.function.executor.AbstractExecutor
io.micronaut.function.executor.FunctionInitializer
- All Implemented Interfaces:
ApplicationContextProvider
,Closeable
,AutoCloseable
A super class that can be used to initialize a function.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
The parse context supplied from therun(String[], Function)
method. -
Field Summary
Fields inherited from class io.micronaut.function.executor.AbstractExecutor
applicationContext
-
Constructor Summary
ModifierConstructorDescriptionConstructor.protected
FunctionInitializer
(ApplicationContext applicationContext) Start a function for an existingApplicationContext
.protected
FunctionInitializer
(ApplicationContext applicationContext, boolean inject) Start a function for an existingApplicationContext
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
injectThis
(ApplicationContext applicationContext) Injects this instance.void
run
(String[] args, Function<FunctionInitializer.ParseContext, ?> supplier) This method is designed to be called when using theFunctionInitializer
from a static Application main method.protected void
startThis
(ApplicationContext applicationContext) Start this environment.Methods inherited from class io.micronaut.function.executor.AbstractExecutor
buildApplicationContext, getApplicationContext, newApplicationContextBuilder, resolveFunction, resolveFunctionName, startEnvironment
-
Field Details
-
closeContext
protected final boolean closeContext
-
-
Constructor Details
-
FunctionInitializer
public FunctionInitializer()Constructor. -
FunctionInitializer
Start a function for an existingApplicationContext
.- Parameters:
applicationContext
- The application context
-
FunctionInitializer
Start a function for an existingApplicationContext
.- Parameters:
applicationContext
- The application contextinject
- inject this into the application flag
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classAbstractExecutor
- Throws:
IOException
-
run
public void run(String[] args, Function<FunctionInitializer.ParseContext, ?> supplier) throws IOExceptionThis method is designed to be called when using theFunctionInitializer
from a static Application main method.- Parameters:
args
- The arguments passed to mainsupplier
- The function that executes this function- Throws:
IOException
- If an error occurs
-
startThis
Start this environment.- Parameters:
applicationContext
- The application context
-
injectThis
Injects this instance.- Parameters:
applicationContext
- TheApplicationContext
-