public class PayloadItem<E extends org.jivesoftware.smack.packet.ExtensionElement> extends Item
Item has several properties that are dependent
on the configuration of the node to which it has been or will be published.
LeafNode.getItems() or Node.addItemEventListener(org.jivesoftware.smackx.pubsub.listener.ItemEventListener)ConfigureFormReader.isPersistItems() and ConfigureFormReader.isDeliverPayloads()set to false.ConfigureFormReader.isDeliverPayloads() set
to true, otherwise it will be null.LeafNode.publish()ConfigureFormReader.isDeliverPayloads() set
to true.To customise the payload object being returned from the getPayload() method, you can
add a custom parser as explained in ItemProvider.
Item.ItemNamespace| Constructor and Description |
|---|
PayloadItem(E payloadExt)
Create an
Item with no id and a payload The id will be set by the server. |
PayloadItem(Item.ItemNamespace itemNamespace,
java.lang.String itemId,
java.lang.String nodeId,
E payloadExt)
Create an
Item with an id, node id and payload. |
PayloadItem(java.lang.String itemId,
E payloadExt)
Create an
Item with an id and payload. |
PayloadItem(java.lang.String itemId,
java.lang.String nodeId,
E payloadExt)
Create an
Item with an id, node id and payload. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addXml(org.jivesoftware.smack.util.XmlStringBuilder xml) |
E |
getPayload()
Get the payload associated with this
Item. |
java.lang.String |
toString() |
getElementName, getNamespace, getNode, getPubSubNamespace, toXMLclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic PayloadItem(E payloadExt)
Item with no id and a payload The id will be set by the server.payloadExt - A ExtensionElement which represents the payload data.public PayloadItem(java.lang.String itemId,
E payloadExt)
Item with an id and payload.itemId - The id of this item. It can be null if we want the server to set the id.payloadExt - A ExtensionElement which represents the payload data.public PayloadItem(java.lang.String itemId,
java.lang.String nodeId,
E payloadExt)
Item with an id, node id and payload.
Note: This is not valid for publishing an item to a node, only receiving from
one as part of Message. If used to create an Item to publish
(via LeafNode.publish(Item), the server may return an
error for an invalid packet.
itemId - The id of this item.nodeId - The id of the node the item was published to.payloadExt - A ExtensionElement which represents the payload data.public PayloadItem(Item.ItemNamespace itemNamespace, java.lang.String itemId, java.lang.String nodeId, E payloadExt)
Item with an id, node id and payload.
Note: This is not valid for publishing an item to a node, only receiving from
one as part of Message. If used to create an Item to publish
(via LeafNode.publish(Item), the server may return an
error for an invalid packet.
itemNamespace - the namespace of the item.itemId - The id of this item.nodeId - The id of the node the item was published to.payloadExt - A ExtensionElement which represents the payload data.public E getPayload()
Item. Customising the payload
parsing from the server can be accomplished as described in ItemProvider.ExtensionElement.protected void addXml(org.jivesoftware.smack.util.XmlStringBuilder xml)