Class VersionUtil

java.lang.Object
ch.qos.logback.core.util.VersionUtil

public class VersionUtil extends Object
Utility class for handling and validating version information of various artifacts.

It is used by logback-classic, logback-access-common, logback-access-jetty11, logback-access-tomcat, etc. to alert users about version discrepancies between dependent and dependee artifacts.

Since:
1.5.25
  • Constructor Details

  • Method Details

    • getVersionOfArtifact

      public static String getVersionOfArtifact(Class<?> aClass)
      Retrieves the version of an artifact, such as logback-core.jar, logback-access-common.jar etc.

      The aClass parameter is assumed to be part of the artifact.

      The method first attempts to get the version from the module information. If the module version is not available, it falls back to retrieving the implementation version from the package.

      Parameters:
      aClass - the class from which to retrieve the version information
      Returns:
      the version of the artifact where aClass is found, or null if the version cannot be determined
      Since:
      2.0.9
    • nonNull

      public static String nonNull(String input)
    • checkForVersionEquality

      public static void checkForVersionEquality(Context context, Class<?> dependentClass, Class<?> dependeeClass, String dependentName, String dependeeName)
    • compareExpectedAndFoundVersion

      public static void compareExpectedAndFoundVersion(Context context, Class<?> dependentClass, Class<?> dependeeClass, String dependentName, String dependeeName)