public class Version extends IQ
An example to discover the version of the server:
// Request the version from the server.
Version versionRequest = new Version();
timeRequest.setType(IQ.Type.GET);
timeRequest.setTo("example.com");
// Create a packet collector to listen for a response.
PacketCollector collector = con.createPacketCollector(
new PacketIDFilter(versionRequest.getPacketID()));
con.sendPacket(versionRequest);
// Wait up to 5 seconds for a result.
IQ result = (IQ)collector.nextResult(5000);
if (result != null && result.getType() == IQ.Type.RESULT) {
Version versionResult = (Version)result;
// Do something with result...
}| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NAMESPACE |
DEFAULT_LANGUAGE, ID_NOT_AVAILABLE| Constructor and Description |
|---|
Version(java.lang.String name,
java.lang.String version,
java.lang.String os)
Creates a new Version object with given details.
|
Version(Version original) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getChildElementXML()
Returns the sub-element XML section of the IQ packet, or null if there
isn't one.
|
java.lang.String |
getName()
Returns the natural-language name of the software.
|
java.lang.String |
getOs()
Returns the operating system of the queried entity.
|
java.lang.String |
getVersion()
Returns the specific version of the software.
|
void |
setName(java.lang.String name)
Sets the natural-language name of the software.
|
void |
setOs(java.lang.String os)
Sets the operating system of the queried entity.
|
void |
setVersion(java.lang.String version)
Sets the specific version of the software.
|
createErrorResponse, createResultIQ, getType, setType, toXMLaddCommonAttributes, addExtension, addExtensions, equals, getDefaultLanguage, getError, getExtension, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getTo, getXmlns, hashCode, nextID, removeExtension, setDefaultXmlns, setError, setFrom, setPacketID, setTo, toStringpublic static final java.lang.String NAMESPACE
public Version(java.lang.String name,
java.lang.String version,
java.lang.String os)
name - The natural-language name of the software. This element is REQUIRED.version - The specific version of the software. This element is REQUIRED.os - The operating system of the queried entity. This element is OPTIONAL.public Version(Version original)
public java.lang.String getName()
public void setName(java.lang.String name)
name - the natural-language name of the software.public java.lang.String getVersion()
public void setVersion(java.lang.String version)
version - the specific version of the software.public java.lang.String getOs()
public void setOs(java.lang.String os)
os - operating system of the queried entity.public java.lang.String getChildElementXML()
IQExtensions of this class must override this method.
getChildElementXML in class IQ