Package org.apache.http.util
Class VersionInfo
java.lang.Object
org.apache.http.util.VersionInfo
public class VersionInfo extends Object
Provides access to version information for HTTP components.
Instances of this class provide version information for a single module
or informal unit, as explained
here.
Static methods are used to extract version information from property
files that are automatically packaged with HTTP component release JARs.
All available version information is provided in strings, where the string format is informal and subject to change without notice. Version information is provided for debugging output and interpretation by humans, not for automated processing in applications.
All available version information is provided in strings, where the string format is informal and subject to change without notice. Version information is provided for debugging output and interpretation by humans, not for automated processing in applications.
- Author:
- Oleg Kalnichevski, and others
-
Field Summary
Fields Modifier and Type Field Description static StringPROPERTY_MODULEstatic StringPROPERTY_RELEASEstatic StringPROPERTY_TIMESTAMPstatic StringUNAVAILABLEA string constant for unavailable information.static StringVERSION_PROPERTY_FILEThe filename of the version information files. -
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected static VersionInfofromMap(String pckg, Map info, ClassLoader clsldr)Instantiates version information from properties.StringgetClassloader()Obtains the classloader used to read the version information.StringgetModule()Obtains the name of the versioned module or informal unit.StringgetPackage()Obtains the package name.StringgetRelease()Obtains the release of the versioned module or informal unit.StringgetTimestamp()Obtains the timestamp of the versioned module or informal unit.static VersionInfo[]loadVersionInfo(String[] pckgs, ClassLoader clsldr)Loads version information for a list of packages.static VersionInfoloadVersionInfo(String pckg, ClassLoader clsldr)Loads version information for a package.StringtoString()Provides the version information in human-readable format.
-
Field Details
-
UNAVAILABLE
A string constant for unavailable information.- See Also:
- Constant Field Values
-
VERSION_PROPERTY_FILE
The filename of the version information files.- See Also:
- Constant Field Values
-
PROPERTY_MODULE
- See Also:
- Constant Field Values
-
PROPERTY_RELEASE
- See Also:
- Constant Field Values
-
PROPERTY_TIMESTAMP
- See Also:
- Constant Field Values
-
-
Constructor Details
-
VersionInfo
Instantiates version information.- Parameters:
pckg- the packagemodule- the module, ornullrelease- the release, ornulltime- the build time, ornullclsldr- the class loader, ornull
-
-
Method Details
-
getPackage
Obtains the package name. The package name identifies the module or informal unit.- Returns:
- the package name, never
null
-
getModule
Obtains the name of the versioned module or informal unit. This data is read from the version information for the package.- Returns:
- the module name, never
null
-
getRelease
Obtains the release of the versioned module or informal unit. This data is read from the version information for the package.- Returns:
- the release version, never
null
-
getTimestamp
Obtains the timestamp of the versioned module or informal unit. This data is read from the version information for the package.- Returns:
- the timestamp, never
null
-
getClassloader
Obtains the classloader used to read the version information. This is just thetoStringoutput of the classloader, since the version information should not keep a reference to the classloader itself. That could prevent garbage collection.- Returns:
- the classloader description, never
null
-
toString
Provides the version information in human-readable format. -
loadVersionInfo
Loads version information for a list of packages.- Parameters:
pckgs- the packages for which to load version infoclsldr- the classloader to load from, ornullfor the thread context classloader- Returns:
- the version information for all packages found,
never
null
-
loadVersionInfo
Loads version information for a package.- Parameters:
pckg- the package for which to load version information, for example "org.apache.http". The package name should NOT end with a dot.clsldr- the classloader to load from, ornullfor the thread context classloader- Returns:
- the version information for the argument package, or
nullif not available
-
fromMap
Instantiates version information from properties.- Parameters:
pckg- the package for the version informationinfo- the map from string keys to string values, for examplePropertiesclsldr- the classloader, ornull- Returns:
- the version information
-