Package com.fasterxml.jackson.core.util
Class VersionUtil
- java.lang.Object
-
- com.fasterxml.jackson.core.util.VersionUtil
-
public class VersionUtil extends java.lang.ObjectFunctionality for supporting exposing of componentVersions. 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.
Note that method for accessing version information changed between versions 2.1 and 2.2; earlier code used file named "VERSION.txt"; but this has serious performance issues on some platforms (Android), so a replacement system was implemented to use class generation and dynamic class loading.
Note that functionality for reading "VERSION.txt" was removed completely from Jackson 2.6.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static VersionmavenVersionFor(java.lang.ClassLoader cl, java.lang.String groupId, java.lang.String artifactId)Deprecated.Since 2.6: functionality not used by any official Jackson component, should be moved out if anyone needs itstatic VersionpackageVersionFor(java.lang.Class<?> cls)Deprecated.Since 2.12 simply useversionFor(Class)insteadstatic VersionparseVersion(java.lang.String s, java.lang.String groupId, java.lang.String artifactId)Method used byPackageVersionclasses to decode version injected by Maven build.static voidthrowInternal()static <T> TthrowInternalReturnAny()Versionversion()Deprecated.static VersionversionFor(java.lang.Class<?> cls)Loads version information by introspecting a class named "PackageVersion" in the same package as the given class.
-
-
-
Method Detail
-
version
@Deprecated public Version version()
Deprecated.
-
versionFor
public static Version versionFor(java.lang.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"
Versionreturned byVersion.unknownVersion().- Parameters:
cls- Class for which to look version information- Returns:
- Version information discovered if any;
Version.unknownVersion()if none
-
packageVersionFor
@Deprecated public static Version packageVersionFor(java.lang.Class<?> cls)
Deprecated.Since 2.12 simply useversionFor(Class)insteadAlias ofversionFor(Class).- Parameters:
cls- Class for which to look version information- Returns:
- Version information discovered if any;
Version.unknownVersion()if none
-
mavenVersionFor
@Deprecated public static Version mavenVersionFor(java.lang.ClassLoader cl, java.lang.String groupId, java.lang.String artifactId)
Deprecated.Since 2.6: functionality not used by any official Jackson component, should be moved out if anyone needs itWill attempt to load the maven version for the given groupId and artifactId. Maven puts a pom.properties file in META-INF/maven/groupId/artifactId, containing the groupId, artifactId and version of the library.- Parameters:
cl- the ClassLoader to load the pom.properties file fromgroupId- the groupId of the libraryartifactId- the artifactId of the library- Returns:
- The version
-
parseVersion
public static Version parseVersion(java.lang.String s, java.lang.String groupId, java.lang.String artifactId)
Method used byPackageVersionclasses to decode version injected by Maven build.- Parameters:
s- Version String to parsegroupId- Maven group id to include with versionartifactId- Maven artifact id to include with version- Returns:
- Version instance constructed from parsed components, if successful;
Version.unknownVersion()if parsing of components fail
-
throwInternal
public static final void throwInternal()
-
throwInternalReturnAny
public static final <T> T throwInternalReturnAny()
-
-