Package io.toro.martini
Class SpringMethods
- java.lang.Object
- 
- io.toro.martini.SpringMethods
 
- 
 public final class SpringMethods extends Object Provides one-liners for performing Spring specific operations. Included in this class are one-liners for adding and removing Spring context files in a MartiniPackage.
- 
- 
Constructor SummaryConstructors Constructor Description SpringMethods(io.toro.martini.spring.PackageSpringContextConfigurer contextConfigurer, MartiniPackageProvider packageProvider)
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddContextFile(String fileName, InputStream contents, String packageName, boolean replaceExisting)Creates a Spring context file from anInputStream.static voidaddContextFile(String fileName, String contents, String packageName, boolean replaceExisting)Creates a Spring context file with the providedcontents.static ObjectgetBean(String beanName, String packageName)Retrieves a bean object from the Spring context.static voidremoveContextFile(String fileName, String packageName, boolean removeFiles)Removes an existing Spring context file a package.
 
- 
- 
- 
Constructor Detail- 
SpringMethods@Autowired public SpringMethods(io.toro.martini.spring.PackageSpringContextConfigurer contextConfigurer, MartiniPackageProvider packageProvider) 
 
- 
 - 
Method Detail- 
addContextFilepublic static void addContextFile(@GloopParameter(defaultValue="spring-context.xml") String fileName, @GloopParameter(allowNull=false) String contents, String packageName, @GloopParameter(defaultValue="false") boolean replaceExisting) Creates a Spring context file with the providedcontents. Registers the context file to a package.- Parameters:
- fileName- the name of to-be-created Spring context file
- contents- the- Stringcontents of the context file
- packageName- the name of the package where the Spring context will be added if empty, this will assume the name of the package where the service is invoked
- replaceExisting- the flag to indicate whether to replace the existing file
- Since:
- 1.1
 
 - 
addContextFilepublic static void addContextFile(@GloopParameter(defaultValue="spring-context.xml") String fileName, @GloopParameter(allowNull=false) InputStream contents, String packageName, @GloopParameter(defaultValue="false") boolean replaceExisting) Creates a Spring context file from anInputStream. Registers the context file to a package.- Parameters:
- fileName- the name of to-be-created Spring context file
- contents- the- InputStreamcontaining the contents of the context file
- packageName- the name of the package where the Spring context will be added if empty, this will assume the name of the package where the service is invoked
- replaceExisting- the flag to indicate whether to replace the existing file
- Since:
- 1.1
 
 - 
removeContextFilepublic static void removeContextFile(@GloopParameter(defaultValue="spring-context.xml") String fileName, String packageName, @GloopParameter(defaultValue="false") boolean removeFiles) Removes an existing Spring context file a package.- Parameters:
- fileName- the name of the existing Spring context file
- packageName- the name of the package where the Spring context will be added if empty, this will assume the name of the package where the service is invoked
- removeFiles- the flag to indicate whether to delete the context files
- Since:
- 1.1
 
 - 
getBeanpublic static Object getBean(@GloopParameter(allowNull=false) String beanName, String packageName) Retrieves a bean object from the Spring context.- Parameters:
- beanName- the name of the bean to retrieve
- packageName- the name of the package where the Spring context resides if empty, this will assume the name of the package where the service is invoked
- Since:
- 1.1
 
 
- 
 
-