public class VersionInfoHC4
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROPERTY_MODULE |
static java.lang.String |
PROPERTY_RELEASE |
static java.lang.String |
PROPERTY_TIMESTAMP |
static java.lang.String |
UNAVAILABLE
A string constant for unavailable information.
|
static java.lang.String |
VERSION_PROPERTY_FILE
The filename of the version information files.
|
| Modifier | Constructor and Description |
|---|---|
protected |
VersionInfoHC4(java.lang.String pckg,
java.lang.String module,
java.lang.String release,
java.lang.String time,
java.lang.String clsldr)
Instantiates version information.
|
| Modifier and Type | Method and Description |
|---|---|
protected static VersionInfoHC4 |
fromMap(java.lang.String pckg,
java.util.Map<?,?> info,
java.lang.ClassLoader clsldr)
Instantiates version information from properties.
|
java.lang.String |
getClassloader()
Obtains the classloader used to read the version information.
|
java.lang.String |
getModule()
Obtains the name of the versioned module or informal unit.
|
java.lang.String |
getPackage()
Obtains the package name.
|
java.lang.String |
getRelease()
Obtains the release of the versioned module or informal unit.
|
java.lang.String |
getTimestamp()
Obtains the timestamp of the versioned module or informal unit.
|
static java.lang.String |
getUserAgent(java.lang.String name,
java.lang.String pkg,
java.lang.Class<?> cls)
Sets the user agent to
"<name>/<release> (Java 1.5 minimum; Java/<java.version>)". |
static org.apache.http.util.VersionInfo[] |
loadVersionInfo(java.lang.String[] pckgs,
java.lang.ClassLoader clsldr)
Loads version information for a list of packages.
|
static VersionInfoHC4 |
loadVersionInfo(java.lang.String pckg,
java.lang.ClassLoader clsldr)
Loads version information for a package.
|
java.lang.String |
toString()
Provides the version information in human-readable format.
|
public static final java.lang.String UNAVAILABLE
public static final java.lang.String VERSION_PROPERTY_FILE
public static final java.lang.String PROPERTY_MODULE
public static final java.lang.String PROPERTY_RELEASE
public static final java.lang.String PROPERTY_TIMESTAMP
protected VersionInfoHC4(java.lang.String pckg,
java.lang.String module,
java.lang.String release,
java.lang.String time,
java.lang.String clsldr)
pckg - the packagemodule - the module, or nullrelease - the release, or nulltime - the build time, or nullclsldr - the class loader, or nullpublic final java.lang.String getPackage()
nullpublic final java.lang.String getModule()
nullpublic final java.lang.String getRelease()
nullpublic final java.lang.String getTimestamp()
nullpublic final java.lang.String getClassloader()
toString output of the classloader,
since the version information should not keep a reference to
the classloader itself. That could prevent garbage collection.nullpublic java.lang.String toString()
toString in class java.lang.Objectpublic static org.apache.http.util.VersionInfo[] loadVersionInfo(java.lang.String[] pckgs,
java.lang.ClassLoader clsldr)
pckgs - the packages for which to load version infoclsldr - the classloader to load from, or
null for the thread context classloadernullpublic static VersionInfoHC4 loadVersionInfo(java.lang.String pckg, java.lang.ClassLoader clsldr)
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 classloadernull if not availableprotected static VersionInfoHC4 fromMap(java.lang.String pckg, java.util.Map<?,?> info, java.lang.ClassLoader clsldr)
pckg - the package for the version informationinfo - the map from string keys to string values,
for example Propertiesclsldr - the classloader, or nullpublic static java.lang.String getUserAgent(java.lang.String name,
java.lang.String pkg,
java.lang.Class<?> cls)
"<name>/<release> (Java 1.5 minimum; Java/<java.version>)".
For example:
"Apache-HttpClient/4.3 (Java 1.5 minimum; Java/1.6.0_35)"
name - the component name, like "Apache-HttpClient".pkg - the package for which to load version information, for example "org.apache.http". The package name
should NOT end with a dot.cls - the class' class loader to load from, or null for the thread context class loaderCopyright © 1999-2015 The Apache Software Foundation. All rights reserved.