Record Class ModuleConfiguration
java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.module.ModuleConfiguration
- Record Components:
runtimeModule- whether this module is a runtime module. Runtime modules are not reloadable and any updates require a cloudnet restart.storesSensitiveData- whether this module stores sensitive data. If true the module configuration will not be dumped to the paste command output.group- the group id of this module.name- the name of this module.version- the version of this module.main- the main entry-point of this module.description- the description of this module.- the developer and author of this module.website- the website associated with this module.dataFolder- the data folder of the module - null results in the default folder structure.repositories- all defined repositories of this module or null if no repositories are defined.dependencies- all defined dependencies of this module or null if no dependencies are defined.minJavaVersionId- the minimum required java version for this module to work.properties- any extra properties for this module.
- All Implemented Interfaces:
Named
public record ModuleConfiguration(boolean runtimeModule, boolean storesSensitiveData, @NonNull String group, @NonNull String name, @NonNull String version, @NonNull String main, @Nullable String description, @Nullable String author, @Nullable String website, @Nullable String dataFolder, @Nullable ModuleRepository[] repositories, @Nullable ModuleDependency[] dependencies, int minJavaVersionId, @Nullable Document properties)
extends Record
implements Named
Represents the module.json file that each module.jar has to contain. The configuration requires the following
properties:
- group
- name
- version
- main
All required dependencies of a module should be listed in the dependencies()
instead of shading them into the module jar.
If a dependency is not located in maven central the repo of the module dependency needs to be specified.
- Since:
- 4.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe field for theauthorrecord component.The field for thedataFolderrecord component.private final @Nullable ModuleDependency[]The field for thedependenciesrecord component.The field for thedescriptionrecord component.The field for thegrouprecord component.The field for themainrecord component.private final intThe field for theminJavaVersionIdrecord component.The field for thenamerecord component.The field for thepropertiesrecord component.private final @Nullable ModuleRepository[]The field for therepositoriesrecord component.private final booleanThe field for theruntimeModulerecord component.private final booleanThe field for thestoresSensitiveDatarecord component.The field for theversionrecord component.The field for thewebsiterecord component. -
Constructor Summary
ConstructorsConstructorDescriptionModuleConfiguration(boolean runtimeModule, boolean storesSensitiveData, @NonNull String group, @NonNull String name, @NonNull String version, @NonNull String main, @Nullable String description, @Nullable String author, @Nullable String website, @Nullable String dataFolder, @Nullable ModuleRepository[] repositories, @Nullable ModuleDependency[] dependencies, int minJavaVersionId, @Nullable Document properties) Creates an instance of aModuleConfigurationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionauthor()Returns the value of theauthorrecord component.booleancanRunOn(@NonNull JavaVersion javaVersion) Checks if this module can run on the specified java runtime version.Returns the value of thedataFolderrecord component.dataFolder(@NonNull Path baseDirectory) Get the data folder path of this module or a default version of it based on the module's name.Returns the value of thedependenciesrecord component.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.group()Returns the value of thegrouprecord component.final inthashCode()Returns a hash code value for this object.main()Returns the value of themainrecord component.Get the minimum java runtime version this module can run on or null if all runtime versions are supported.intReturns the value of theminJavaVersionIdrecord component.name()Returns the value of thenamerecord component.Returns the value of thepropertiesrecord component.Returns the value of therepositoriesrecord component.booleanReturns the value of theruntimeModulerecord component.booleanReturns the value of thestoresSensitiveDatarecord component.final StringtoString()Returns a string representation of this record class.version()Returns the value of theversionrecord component.website()Returns the value of thewebsiterecord component.
-
Field Details
-
runtimeModule
private final boolean runtimeModuleThe field for theruntimeModulerecord component. -
storesSensitiveData
private final boolean storesSensitiveDataThe field for thestoresSensitiveDatarecord component. -
group
-
name
-
version
-
main
-
description
The field for thedescriptionrecord component. -
author
-
website
-
dataFolder
The field for thedataFolderrecord component. -
repositories
The field for therepositoriesrecord component. -
dependencies
The field for thedependenciesrecord component. -
minJavaVersionId
private final int minJavaVersionIdThe field for theminJavaVersionIdrecord component. -
properties
The field for thepropertiesrecord component.
-
-
Constructor Details
-
ModuleConfiguration
public ModuleConfiguration(boolean runtimeModule, boolean storesSensitiveData, @NonNull @NonNull String group, @NonNull @NonNull String name, @NonNull @NonNull String version, @NonNull @NonNull String main, @Nullable @Nullable String description, @Nullable @Nullable String author, @Nullable @Nullable String website, @Nullable @Nullable String dataFolder, @Nullable @Nullable ModuleRepository[] repositories, @Nullable @Nullable ModuleDependency[] dependencies, int minJavaVersionId, @Nullable @Nullable Document properties) Creates an instance of aModuleConfigurationrecord class.- Parameters:
runtimeModule- the value for theruntimeModulerecord componentstoresSensitiveData- the value for thestoresSensitiveDatarecord componentgroup- the value for thegrouprecord componentname- the value for thenamerecord componentversion- the value for theversionrecord componentmain- the value for themainrecord componentdescription- the value for thedescriptionrecord componentauthor- the value for theauthorrecord componentwebsite- the value for thewebsiterecord componentdataFolder- the value for thedataFolderrecord componentrepositories- the value for therepositoriesrecord componentdependencies- the value for thedependenciesrecord componentminJavaVersionId- the value for theminJavaVersionIdrecord componentproperties- the value for thepropertiesrecord component
-
-
Method Details
-
dataFolder
Get the data folder path of this module or a default version of it based on the module's name.- Parameters:
baseDirectory- the base directory of the module provider used to resolve the data folder if no data folder is specified explicitly.- Returns:
- the data folder in path form of this module.
-
minJavaVersion
Get the minimum java runtime version this module can run on or null if all runtime versions are supported.- Returns:
- the minimum java runtime version this module can run on.
-
canRunOn
Checks if this module can run on the specified java runtime version.- Parameters:
javaVersion- the runtime version to check.- Returns:
- if this module can run on the specified java version.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
runtimeModule
public boolean runtimeModule()Returns the value of theruntimeModulerecord component.- Returns:
- the value of the
runtimeModulerecord component
-
storesSensitiveData
public boolean storesSensitiveData()Returns the value of thestoresSensitiveDatarecord component.- Returns:
- the value of the
storesSensitiveDatarecord component
-
group
-
name
-
version
-
main
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
author
-
website
-
dataFolder
Returns the value of thedataFolderrecord component.- Returns:
- the value of the
dataFolderrecord component
-
repositories
Returns the value of therepositoriesrecord component.- Returns:
- the value of the
repositoriesrecord component
-
dependencies
Returns the value of thedependenciesrecord component.- Returns:
- the value of the
dependenciesrecord component
-
minJavaVersionId
public int minJavaVersionId()Returns the value of theminJavaVersionIdrecord component.- Returns:
- the value of the
minJavaVersionIdrecord component
-
properties
Returns the value of thepropertiesrecord component.- Returns:
- the value of the
propertiesrecord component
-