public class DiscoverInfo extends IQ implements TypedCloneable<DiscoverInfo>
The received information may contain one or more identities of the requested XMPP entity, and a list of supported features by the requested XMPP entity.
Modifier and Type | Class and Description |
---|---|
static class |
DiscoverInfo.Feature
Represents the features offered by the item.
|
static class |
DiscoverInfo.Identity
Represents the identity of a given XMPP entity.
|
IQ.IQChildElementXmlStringBuilder, IQ.Type
Modifier and Type | Field and Description |
---|---|
static String |
ELEMENT |
static String |
NAMESPACE |
IQ_ELEMENT, QUERY_ELEMENT
DEFAULT_LANGUAGE, ITEM, language, TEXT
Constructor and Description |
---|
DiscoverInfo() |
DiscoverInfo(DiscoverInfo d)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addFeature(DiscoverInfo.Feature feature) |
boolean |
addFeature(String feature)
Adds a new feature to the discovered information.
|
void |
addFeatures(Collection<String> featuresToAdd)
Adds a collection of features to the packet.
|
void |
addIdentities(Collection<DiscoverInfo.Identity> identitiesToAdd)
Adds identities to the DiscoverInfo stanza.
|
void |
addIdentity(DiscoverInfo.Identity identity)
Adds a new identity of the requested entity to the discovered information.
|
DiscoverInfo |
clone()
Clone this instance.
|
boolean |
containsDuplicateFeatures()
Test if a DiscoverInfo response contains duplicate features.
|
boolean |
containsDuplicateIdentities()
Test if a DiscoverInfo response contains duplicate identities.
|
boolean |
containsFeature(CharSequence feature)
Returns true if the specified feature is part of the discovered information.
|
List<DiscoverInfo.Feature> |
getFeatures()
Returns the discovered features of an XMPP entity.
|
List<DiscoverInfo.Identity> |
getIdentities()
Returns the discovered identities of an XMPP entity.
|
List<DiscoverInfo.Identity> |
getIdentities(String category,
String type)
Returns all Identities of the given category and type of this DiscoverInfo.
|
protected IQ.IQChildElementXmlStringBuilder |
getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder xml)
This method must be overwritten by IQ subclasses to create their child content.
|
String |
getNode()
Returns the node attribute that supplements the 'jid' attribute.
|
boolean |
hasIdentity(String category,
String type)
Returns true if this DiscoverInfo contains at least one Identity of the given category and type.
|
void |
setNode(String node)
Sets the node attribute that supplements the 'jid' attribute.
|
createErrorResponse, createErrorResponse, createErrorResponse, createResultIQ, getChildElementName, getChildElementNamespace, getChildElementXML, getChildElementXML, getType, initializeAsResultFor, initialzeAsResultFor, isRequestIQ, setType, toString, toXML
addCommonAttributes, addExtension, addExtensions, appendErrorIfExists, getDefaultLanguage, getError, getExtension, getExtension, getExtensions, getExtensions, getFrom, getLanguage, getPacketID, getStanzaId, getTo, hasExtension, hasExtension, hasStanzaIdSet, logCommonAttributes, overrideExtension, removeExtension, removeExtension, setError, setError, setFrom, setFrom, setLanguage, setPacketID, setStanzaId, setStanzaId, setTo, setTo
public static final String ELEMENT
public static final String NAMESPACE
public DiscoverInfo()
public DiscoverInfo(DiscoverInfo d)
d
- public boolean addFeature(String feature)
feature
- the discovered featurepublic void addFeatures(Collection<String> featuresToAdd)
featuresToAdd
- public boolean addFeature(DiscoverInfo.Feature feature)
public List<DiscoverInfo.Feature> getFeatures()
public void addIdentity(DiscoverInfo.Identity identity)
identity
- the discovered entity's identitypublic void addIdentities(Collection<DiscoverInfo.Identity> identitiesToAdd)
identitiesToAdd
- public List<DiscoverInfo.Identity> getIdentities()
public boolean hasIdentity(String category, String type)
category
- the category to look for.type
- the type to look for.public List<DiscoverInfo.Identity> getIdentities(String category, String type)
category
- category the category to look for.type
- type the type to look for.public String getNode()
Node attributes SHOULD be used only when trying to provide or query information which is not directly addressable.
public void setNode(String node)
Node attributes SHOULD be used only when trying to provide or query information which is not directly addressable.
node
- the node attribute that supplements the 'jid' attributepublic boolean containsFeature(CharSequence feature)
feature
- the feature to checkprotected IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQ.IQChildElementXmlStringBuilder xml)
IQ
IQ.IQChildElementXmlStringBuilder
after eventual existing ExtensionElement
s have been added.
For example to create an IQ with a extra attribute and an additional child element
<iq to='foo@example.org' id='123'>
<bar xmlns='example:bar' extraAttribute='blaz'>
<extraElement>elementText</extraElement>
</bar>
</iq>
the body of the getIQChildElementBuilder
looks like
// The builder 'xml' will already have the child element and the 'xmlns' attribute added
// So the current builder state is "<bar xmlns='example:bar'"
xml.attribute("extraAttribute", "blaz");
xml.rightAngleBracket();
xml.element("extraElement", "elementText");
// Do not close the 'bar' attribute by calling xml.closeElement('bar')
If your IQ only contains attributes and no child elements, i.e. it can be represented as empty element, then you
can mark it as such.
xml.attribute("myAttribute", "myAttributeValue"); xml.setEmptyElement();If your IQ does not contain any attributes or child elements (besides
ExtensionElement
s), consider sub-classing
SimpleIQ
instead.getIQChildElementBuilder
in class IQ
xml
- a pre-created builder which already has the child element and the 'xmlns' attribute set.public boolean containsDuplicateIdentities()
public boolean containsDuplicateFeatures()
public DiscoverInfo clone()
TypedCloneable
clone
in interface TypedCloneable<DiscoverInfo>
clone
in class Object