Package com.chillycheesy.modulo.modules
Class ModuleBuilder
java.lang.Object
com.chillycheesy.modulo.modules.ModuleBuilder
Class used to build a
The file you want to build should be a jar file with a module.yml at the root of the jar.
Module
from a File
The file you want to build should be a jar file with a module.yml at the root of the jar.
name: <name of your module>
version: <version of your module>
authors: [<the persons that works on your module>]
dependencies: [<modules you need to load your module>]
soft-dependencies: [<modules you can work with without needing it>]
main: <the path to you module class> for exemple: (com.dev.module.MyAwesomeModule)
-
Method Summary
Modifier and TypeMethodDescriptionstatic Module
Method you need to call to build aModule
.static Module
build(File file, URLClassLoader urlClassLoader)
Method you need to call to build aModule
static ModuleConfig
Reads the yml file in the root of the jar passed in parameterstatic ModuleConfig
readYml(File file, InputStream inputStream)
Reads the yml file in the root of the jar passed in parameter
-
Method Details
-
build
Method you need to call to build aModule
- Parameters:
file
- file you want to buildurlClassLoader
- theURLClassLoader
you want to use to load the jar modules- Returns:
- the built module
-
build
Method you need to call to build aModule
. It will use the defaultURLClassLoader
to load the jar modules, which is the FactoryURLClassLoader- Parameters:
file
- file you want to build- Returns:
- the built module
-
readYml
public static ModuleConfig readYml(File file) throws IOException, InvalidModuleConfigurationExceptionReads the yml file in the root of the jar passed in parameter- Parameters:
file
- the jar file of yourModule
- Returns:
- a
ModuleConfig
- Throws:
IOException
- if the file can't be access or readInvalidModuleConfigurationException
- if the configuration doesn't match the rules described on top of the class
-
readYml
public static ModuleConfig readYml(File file, InputStream inputStream) throws IOException, InvalidModuleConfigurationExceptionReads the yml file in the root of the jar passed in parameter- Parameters:
file
- the jar file of yourModule
inputStream
- theInputStream
you especially want to use- Returns:
- a
ModuleConfig
- Throws:
IOException
- if the file can't be access or read.InvalidModuleConfigurationException
- if the configuration doesn't match the rules described on top of the class.
-