Package org.owasp.dependencycheck.utils
Class DependencyVersionUtil
- java.lang.Object
-
- org.owasp.dependencycheck.utils.DependencyVersionUtil
-
@ThreadSafe public final class DependencyVersionUtil extends java.lang.ObjectA utility class to extract version numbers from file names (or other strings containing version numbers.
- Author:
- Jeremy Long
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringparsePreVersion(java.lang.String text)A utility class to extract the part before version numbers from file names (or other strings containing version numbers.static DependencyVersionparseVersion(java.lang.String text)A utility class to extract version numbers from file names (or other strings containing version numbers.static DependencyVersionparseVersion(java.lang.String text, boolean firstMatchOnly)A utility class to extract version numbers from file names (or other strings containing version numbers.
-
-
-
Method Detail
-
parseVersion
public static DependencyVersion parseVersion(java.lang.String text)
A utility class to extract version numbers from file names (or other strings containing version numbers.
Example: Give the file name: library-name-1.4.1r2-release.jar This function would return: 1.4.1.r2
- Parameters:
text- the text being analyzed- Returns:
- a DependencyVersion containing the version
-
parseVersion
public static DependencyVersion parseVersion(java.lang.String text, boolean firstMatchOnly)
A utility class to extract version numbers from file names (or other strings containing version numbers.
Example: Give the file name: library-name-1.4.1r2-release.jar This function would return: 1.4.1.r2
- Parameters:
text- the text being analyzedfirstMatchOnly- iffalseand more then one version string is found in the given text, null will be returned. Otherwise, the first version found will be returned.- Returns:
- a DependencyVersion containing the version
-
parsePreVersion
public static java.lang.String parsePreVersion(java.lang.String text)
A utility class to extract the part before version numbers from file names (or other strings containing version numbers. In most cases, this part represents a more accurate name than the full file name.
Example: Give the file name: library-name-1.4.1r2-release.jar This function would return: library-name
- Parameters:
text- the text being analyzed- Returns:
- the part before the version numbers if any, otherwise return the text itself.
-
-