public class

VersionInfo

extends Object
java.lang.Object
   ↳ org.apache.http.util.VersionInfo

Class Overview

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.

Summary

Constants
String PROPERTY_MODULE
String PROPERTY_RELEASE
String PROPERTY_TIMESTAMP
String UNAVAILABLE A string constant for unavailable information.
String VERSION_PROPERTY_FILE The filename of the version information files.
Protected Constructors
VersionInfo(String pckg, String module, String release, String time, String clsldr)
Instantiates version information.
Public Methods
final String getClassloader()
Obtains the classloader used to read the version information.
final String getModule()
Obtains the name of the versioned module or informal unit.
final String getPackage()
Obtains the package name.
final String getRelease()
Obtains the release of the versioned module or informal unit.
final String getTimestamp()
Obtains the timestamp of the versioned module or informal unit.
final static VersionInfo[] loadVersionInfo(String[] pckgs, ClassLoader clsldr)
Loads version information for a list of packages.
final static VersionInfo loadVersionInfo(String pckg, ClassLoader clsldr)
Loads version information for a package.
String toString()
Provides the version information in human-readable format.
Protected Methods
final static VersionInfo fromMap(String pckg, Map info, ClassLoader clsldr)
Instantiates version information from properties.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String PROPERTY_MODULE

Since: API Level 1

Constant Value: "info.module"

public static final String PROPERTY_RELEASE

Since: API Level 1

Constant Value: "info.release"

public static final String PROPERTY_TIMESTAMP

Since: API Level 1

Constant Value: "info.timestamp"

public static final String UNAVAILABLE

Since: API Level 1

A string constant for unavailable information.

Constant Value: "UNAVAILABLE"

public static final String VERSION_PROPERTY_FILE

Since: API Level 1

The filename of the version information files.

Constant Value: "version.properties"

Protected Constructors

protected VersionInfo (String pckg, String module, String release, String time, String clsldr)

Since: API Level 1

Instantiates version information.

Parameters
pckg the package
module the module, or null
release the release, or null
time the build time, or null
clsldr the class loader, or null

Public Methods

public final String getClassloader ()

Since: API Level 1

Obtains the classloader used to read the version information. This is just the toString output 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

public final String getModule ()

Since: API Level 1

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

public final String getPackage ()

Since: API Level 1

Obtains the package name. The package name identifies the module or informal unit.

Returns
  • the package name, never null

public final String getRelease ()

Since: API Level 1

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

public final String getTimestamp ()

Since: API Level 1

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

public static final VersionInfo[] loadVersionInfo (String[] pckgs, ClassLoader clsldr)

Since: API Level 1

Loads version information for a list of packages.

Parameters
pckgs the packages for which to load version info
clsldr the classloader to load from, or null for the thread context classloader
Returns
  • the version information for all packages found, never null

public static final VersionInfo loadVersionInfo (String pckg, ClassLoader clsldr)

Since: API Level 1

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, or null for the thread context classloader
Returns
  • the version information for the argument package, or null if not available

public String toString ()

Since: API Level 1

Provides the version information in human-readable format.

Returns
  • a string holding this version information

Protected Methods

protected static final VersionInfo fromMap (String pckg, Map info, ClassLoader clsldr)

Since: API Level 1

Instantiates version information from properties.

Parameters
pckg the package for the version information
info the map from string keys to string values, for example Properties
clsldr the classloader, or null
Returns
  • the version information