Package mireka.startup
Class ScriptApi
- Object
-
- mireka.startup.ScriptApi
-
public class ScriptApi extends ObjectScriptApi provides functions which are called from the configuration scripts.
-
-
Field Summary
Fields Modifier and Type Field Description javax.script.ScriptEngineenginejava.util.Stack<java.io.File>includeStack
-
Constructor Summary
Constructors Constructor Description ScriptApi()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectaddInjectableObject(Object object)Registers the object as an object which can be injected later into an uninitialized property.Objectinclude(String fileName)Include another configuration file.voidinjectMissingPropertyValues(Object object, java.util.List<String> initializedProperties)Initializes the properties that has not got a value explicitly and are annotated with @Inject annotation with default objects selected from the set of injectable objects.Objectmanage(Object object)Registers objects created by the configuration script for lifecycle management, which includes calling methods marked withPostConstructandPreDestroyannotations.
-
-
-
Method Detail
-
include
public Object include(String fileName) throws java.io.IOException, javax.script.ScriptExceptionInclude another configuration file.- Parameters:
fileName- the path to the script file to be included. Relative paths are resolved against the mireka.home directory.- Returns:
- the result of the included file, in case of JavaScript, this is the result of the last statement.
- Throws:
java.io.IOException- thrown if the file cannot be openedjavax.script.ScriptException- thrown if the script in the included file cannot be run because of a syntactic or semantic error
-
manage
public Object manage(Object object)
Registers objects created by the configuration script for lifecycle management, which includes calling methods marked withPostConstructandPreDestroyannotations.- Parameters:
object- the object which may have a lifecycle annotation.- Returns:
- the object argument
- See Also:
Lifecycle
-
addInjectableObject
public Object addInjectableObject(Object object)
Registers the object as an object which can be injected later into an uninitialized property.- Parameters:
object- The object which can be injected- Returns:
- the object argument
- See Also:
DependencyInjection.addInjectable(Object)
-
injectMissingPropertyValues
public void injectMissingPropertyValues(Object object, java.util.List<String> initializedProperties)Initializes the properties that has not got a value explicitly and are annotated with @Inject annotation with default objects selected from the set of injectable objects.- Parameters:
object- The object that may have uninitialized propertiesinitializedProperties- The list of properties which were explicitly initialized.- See Also:
DependencyInjection.injectDependencies(Object, List)
-
-