Class BaseCliApplication.AbstractMetadataProvider

  • All Implemented Interfaces:
    picocli.CommandLine.IVersionProvider
    Enclosing class:
    BaseCliApplication

    protected abstract static class BaseCliApplication.AbstractMetadataProvider
    extends java.lang.Object
    implements picocli.CommandLine.IVersionProvider
    Strategy 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 as ExampleApp-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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String[] getVersion()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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:
        getVersion in interface picocli.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