Package com.globalmentor.application
Class BaseCliApplication.AbstractMetadataProvider
- java.lang.Object
-
- com.globalmentor.application.BaseCliApplication.AbstractMetadataProvider
-
- All Implemented Interfaces:
picocli.CommandLine.IVersionProvider
- Enclosing class:
- BaseCliApplication
protected abstract static class BaseCliApplication.AbstractMetadataProvider extends java.lang.Object implements picocli.CommandLine.IVersionProviderStrategy for retrieving the application name and version from the configuration. Each application should extend this class and pass it the concrete application class in the constructor.This class expects a configuration file with the same name as the application class indicated in the constructor with a base extension of
-config, such asExampleApp-config.properties, loaded via Confound from the resources in the same path as the application class. For example:name=${project.name} version=${project.version}- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description AbstractMetadataProvider(java.lang.Class<? extends Application> applicationClass)Application class constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]getVersion()
-
-
-
Constructor Detail
-
AbstractMetadataProvider
public AbstractMetadataProvider(@Nonnull java.lang.Class<? extends Application> applicationClass)Application class constructor.- Parameters:
applicationClass- The given application class for relative look up of configuration resources.
-
-
Method Detail
-
getVersion
public java.lang.String[] getVersion() throws java.lang.Exception- Specified by:
getVersionin interfacepicocli.CommandLine.IVersionProvider- Implementation Specification:
- This implementation retrieves the name from resources for the concrete application class using the resource key "version".
- Throws:
io.confound.config.ConfigurationException- if there was an error retrieving the configured name or the name could not be found.java.lang.Exception- See Also:
BaseCliApplication.CONFIG_KEY_VERSION
-
-