Class VersionUtil
- Since:
- 2.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetDetailedVersion(@NonNull Class<?> cls, String fallback) Deprecated, for removal: This API element is subject to removal in a future version.Gets the detailed version from the project or library the provided class belongs to.static StringgetDetailedVersion(Class<?> cls) Deprecated, for removal: This API element is subject to removal in a future version.Gets the detailed version from the project or library the provided class belongs to.static StringgetVersion(@NonNull Class<?> cls, String fallback) Deprecated, for removal: This API element is subject to removal in a future version.Gets the version from the project or library the provided class belongs to.static StringgetVersion(Class<?> cls) Deprecated, for removal: This API element is subject to removal in a future version.Gets the version from the project or library the provided class belongs to.
-
Method Details
-
getVersion
Deprecated, for removal: This API element is subject to removal in a future version.Gets the version from the project or library the provided class belongs to. This method attempts to read that version information from the class package implementation details, normally found in jar manifest files.
The manifest is often created when the code is packaged for distribution. For instance, if you use Maven, you can ask it to automaticall store implementation details with the manifest file when creating a jar file by setting
addDefaultImplementationEntriesset totrue(see https://maven.apache.org/shared/maven-archiver/).If developing (not yet packaged), an attempt is made to locate a pom.xml and load the version from it.
- Parameters:
cls- the class used to extract version- Returns:
- the version number or
nullif not found
-
getVersion
Deprecated, for removal: This API element is subject to removal in a future version.Gets the version from the project or library the provided class belongs to. This method attempts to read that version information from the class package implementation details, normally found in jar manifest files.
The manifest is often created when the code is packaged for distribution. For instance, if you use Maven, you can ask it to automaticall store implementation details with the manifest file when creating a jar file by setting
addDefaultImplementationEntriesset totrue(see https://maven.apache.org/shared/maven-archiver/).If developing (not yet packaged), an attempt is made to locate a pom.xml and load the version from it.
- Parameters:
cls- the class used to extract versionfallback- text to return when no version could be found- Returns:
- the version number or the fallback value if not found
-
getDetailedVersion
Deprecated, for removal: This API element is subject to removal in a future version.Gets the detailed version from the project or library the provided class belongs to. This method attempts to read that version information from the class package implementation details, normally found in jar manifest files.
The manifest is often created when the code is packaged for distribution. For instance, if you use Maven, you can ask it to automaticall store implementation details with the manifest file when creating a jar file by setting
addDefaultImplementationEntriesset totrue(see https://maven.apache.org/shared/maven-archiver/).If developing (not yet packaged), an attempt is made to locate a pom.xml and load the version from it.
- Parameters:
cls- the class used to extract version- Returns:
- the version number or the fallback value if not found
-
getDetailedVersion
Deprecated, for removal: This API element is subject to removal in a future version.Gets the detailed version from the project or library the provided class belongs to. This method attempts to read that version information from the class package implementation details, normally found in jar manifest files.
The manifest is often created when the code is packaged for distribution. For instance, if you use Maven, you can ask it to automatically store implementation details with the manifest file when creating a jar file by setting
addDefaultImplementationEntriesset totrue(see https://maven.apache.org/shared/maven-archiver/).If developing (not yet packaged), an attempt is made to locate a pom.xml and load the version from it.
- Parameters:
cls- the class used to extract versionfallback- text to return when no version could be found- Returns:
- the version number or the fallback value if not found
-
PackageManifestinstead.