public class PayloadItem<E extends ExtensionElement> extends Item
LeafNode.getItems()
or Node.addItemEventListener(org.jivesoftware.smackx.pubsub.listener.ItemEventListener)
ConfigureForm.isPersistItems()
and ConfigureForm.isDeliverPayloads()
set to false.
ConfigureForm.isDeliverPayloads()
set
to true, otherwise it will be null.
LeafNode.send()
or LeafNode.publish()
ConfigureForm.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
.
Constructor and Description |
---|
PayloadItem(E payloadExt)
Create an Item with no id and a payload The id will be set by the server.
|
PayloadItem(String itemId,
E payloadExt)
Create an Item with an id and payload.
|
PayloadItem(String itemId,
String nodeId,
E payloadExt)
Create an Item with an id, node id and payload.
|
Modifier and Type | Method and Description |
---|---|
E |
getPayload()
Get the payload associated with this Item.
|
String |
toString() |
String |
toXML()
Returns the XML representation of this Element.
|
getId, getNamespace
getElementName, getNode
public PayloadItem(E payloadExt)
payloadExt
- A ExtensionElement
which represents the payload data.public PayloadItem(String itemId, E payloadExt)
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(String itemId, String nodeId, E payloadExt)
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 E getPayload()
ItemProvider
.ExtensionElement
.public String toXML()
Element