Top Description Inners Fields Constructors Methods
nonapi.io.github.classgraph.utils

public final Class VersionFinder

extends Object
Class Inheritance
Imports
java.io.File, .IOException, .InputStream, java.net.URL, java.nio.file.Files, .Path, .Paths, java.util.ArrayList, .List, .Locale, .Properties, javax.xml.XMLConstants, javax.xml.parsers.DocumentBuilderFactory, .ParserConfigurationException, javax.xml.xpath.XPathConstants, .XPathFactory, .XPathFactoryConfigurationException, org.w3c.dom.Document, io.github.classgraph.ClassGraph

Finds the version number of ClassGraph, and the version of the JDK.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
VersionFinder.OperatingSystem

The operating system type.

Field Summary

Modifier and TypeField and Description
public static final boolean
JAVA_IS_EA_VERSION

Java is EA release -- true for "11-ea", etc.

public static final int
JAVA_MAJOR_VERSION

Java major version -- 7 for "1.7", 8 for "1.8.0_244", 9 for "9", 11 for "11-ea", etc.

public static final int
JAVA_MINOR_VERSION

Java minor version -- 0 for "11.0.4"

public static final int
JAVA_SUB_VERSION

Java minor version -- 4 for "11.0.4"

public static final String
JAVA_VERSION

Java version string.

private static final String
MAVEN_ARTIFACT

The Maven artifact for ClassGraph.

private static final String
MAVEN_PACKAGE

The Maven package for ClassGraph.

public static final VersionFinder.OperatingSystem
OS

The operating system type.

Constructor Summary

AccessConstructor and Description
private
VersionFinder()

Constructor.

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

the property value
getProperty
(final String
the property name
propName
)

Get a system property (returning null if a SecurityException was thrown).

public static String

Returns:

the property value, or the default if the property is not defined.
getProperty
(final String
the property name
propName
,
final String
the default value for the property
defaultVal
)

Get a system property (returning null if a SecurityException was thrown).

private static DocumentBuilderFactory

Returns:

DocumentBuilderFactory
getSecureDocumentBuilderFactory
()

Helper method to provide a XXE secured DocumentBuilder Factory.

private static XPathFactory

Returns:

XPathFactory
getSecureXPathFactory
()

Helper method to provide a XXE secured XPathFactory Factory.

public static synchronized String

Returns:

the version number of ClassGraph.
getVersion
()

Get the version number of ClassGraph.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

JAVA_IS_EA_VERSIONback to summary
public static final boolean JAVA_IS_EA_VERSION

Java is EA release -- true for "11-ea", etc.

JAVA_MAJOR_VERSIONback to summary
public static final int JAVA_MAJOR_VERSION

Java major version -- 7 for "1.7", 8 for "1.8.0_244", 9 for "9", 11 for "11-ea", etc.

JAVA_MINOR_VERSIONback to summary
public static final int JAVA_MINOR_VERSION

Java minor version -- 0 for "11.0.4"

JAVA_SUB_VERSIONback to summary
public static final int JAVA_SUB_VERSION

Java minor version -- 4 for "11.0.4"

JAVA_VERSIONback to summary
public static final String JAVA_VERSION

Java version string.

MAVEN_ARTIFACTback to summary
private static final String MAVEN_ARTIFACT

The Maven artifact for ClassGraph.

MAVEN_PACKAGEback to summary
private static final String MAVEN_PACKAGE

The Maven package for ClassGraph.

OSback to summary
public static final VersionFinder.OperatingSystem OS

The operating system type.

Constructor Detail

VersionFinderback to summary
private VersionFinder()

Constructor.

Method Detail

getPropertyback to summary
public static String getProperty(final String propName)

Get a system property (returning null if a SecurityException was thrown).

Parameters
propName:String

the property name

Returns:String

the property value

getPropertyback to summary
public static String getProperty(final String propName, final String defaultVal)

Get a system property (returning null if a SecurityException was thrown).

Parameters
propName:String

the property name

defaultVal:String

the default value for the property

Returns:String

the property value, or the default if the property is not defined.

getSecureDocumentBuilderFactoryback to summary
private static DocumentBuilderFactory getSecureDocumentBuilderFactory() throws ParserConfigurationException

Helper method to provide a XXE secured DocumentBuilder Factory. reference - https://gist.github.com/AlainODea/1779a7c6a26a5c135280bc9b3b71868f reference - https://rules.sonarsource.com/java/tag/owasp/RSPEC-2755

Returns:DocumentBuilderFactory

DocumentBuilderFactory

getSecureXPathFactoryback to summary
private static XPathFactory getSecureXPathFactory() throws XPathFactoryConfigurationException

Helper method to provide a XXE secured XPathFactory Factory. reference - https://rules.sonarsource.com/java/tag/owasp/RSPEC-2755

Returns:XPathFactory

XPathFactory

getVersionback to summary
public static synchronized String getVersion()

Get the version number of ClassGraph.

Returns:String

the version number of ClassGraph.

nonapi.io.github.classgraph.utils back to summary

public final Enum VersionFinder.OperatingSystem

extends Enum<VersionFinder.OperatingSystem>
Class Inheritance

The operating system type.

Field Summary

Modifier and TypeField and Description
public static final VersionFinder.OperatingSystem
BSD

BSD.

public static final VersionFinder.OperatingSystem
Linux

Linux.

public static final VersionFinder.OperatingSystem
MacOSX

Mac OS X.

public static final VersionFinder.OperatingSystem
Solaris

Solaris.

public static final VersionFinder.OperatingSystem
Unix

Unix or AIX.

public static final VersionFinder.OperatingSystem
Unknown

Unknown.

public static final VersionFinder.OperatingSystem
Windows

Windows.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static VersionFinder.OperatingSystem
public static VersionFinder.OperatingSystem[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BSDback to summary
public static final VersionFinder.OperatingSystem BSD

BSD.

Linuxback to summary
public static final VersionFinder.OperatingSystem Linux

Linux.

MacOSXback to summary
public static final VersionFinder.OperatingSystem MacOSX

Mac OS X.

Solarisback to summary
public static final VersionFinder.OperatingSystem Solaris

Solaris.

Unixback to summary
public static final VersionFinder.OperatingSystem Unix

Unix or AIX.

Unknownback to summary
public static final VersionFinder.OperatingSystem Unknown

Unknown.

Windowsback to summary
public static final VersionFinder.OperatingSystem Windows

Windows.

Constructor Detail

OperatingSystemback to summary
private OperatingSystem()

Method Detail

valueOfback to summary
public static VersionFinder.OperatingSystem valueOf(String name)
valuesback to summary
public static VersionFinder.OperatingSystem[] values()