Class VersionUtil

java.lang.Object
tools.jackson.core.util.VersionUtil

public class VersionUtil extends Object
Functionality for supporting exposing of component Versions. Also contains other misc methods that have no other place to live in.

Note that this class can be used in two roles: first, as a static utility class for loading purposes, and second, as a singleton loader of per-module version information.

  • Constructor Details

    • VersionUtil

      protected VersionUtil()
  • Method Details

    • versionFor

      public static Version versionFor(Class<?> cls)
      Loads version information by introspecting a class named "PackageVersion" in the same package as the given class.

      If the class could not be found or does not have a public static Version field named "VERSION", returns "empty" Version returned by Version.unknownVersion().

      Parameters:
      cls - Class for which to look version information
      Returns:
      Version information discovered if any; Version.unknownVersion() if none
    • parseVersion

      public static Version parseVersion(String s, String groupId, String artifactId)
      Method used by PackageVersion classes to decode version injected by Maven build.
      Parameters:
      s - Version String to parse
      groupId - Maven group id to include with version
      artifactId - Maven artifact id to include with version
      Returns:
      Version instance constructed from parsed components, if successful; Version.unknownVersion() if parsing of components fail
    • parseVersionPart

      public static int parseVersionPart(String s)
    • throwInternal

      public static final void throwInternal()
    • throwInternalReturnAny

      public static final <T> T throwInternalReturnAny()