public class Item extends NodeExtension
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() or LeafNode.publish()ConfigureFormReader.isDeliverPayloads() set
to true.
To customise the payload object being returned from the PayloadItem.getPayload() method, you can
add a custom parser as explained in ItemProvider.
| Modifier and Type | Class and Description |
|---|---|
static class |
Item.ItemNamespace |
| Constructor and Description |
|---|
Item()
Create an empty
Item with no id. |
Item(Item.ItemNamespace itemNamespace,
java.lang.String itemId)
Create an
Item with an id but no payload. |
Item(Item.ItemNamespace itemNamespace,
java.lang.String itemId,
java.lang.String nodeId)
Create an
Item with an id and a node id. |
Item(java.lang.String itemId)
Create an
Item with an id but no payload. |
Item(java.lang.String itemId,
java.lang.String nodeId)
Create an
Item with an id and a node id. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addXml(org.jivesoftware.smack.util.XmlStringBuilder xml) |
java.lang.String |
getId()
Get the item id.
|
java.lang.String |
toString() |
getElementName, getNamespace, getNode, getPubSubNamespace, toXMLclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic Item()
Item with no id. This is a valid item for nodes which are configured
so that ConfigureFormReader.isDeliverPayloads() is false. In most cases an id will be generated by the server.
For nodes configured with ConfigureFormReader.isDeliverPayloads() and ConfigureFormReader.isPersistItems()
set to false, no Item is sent to the node, you have to use the LeafNode.publish()
method in this case.public Item(java.lang.String itemId)
Item with an id but no payload. This is a valid item for nodes which are configured
so that ConfigureFormReader.isDeliverPayloads() is false.itemId - The id if the item. It must be unique within the node unless overwriting and existing item.
Passing null is the equivalent of calling Item().public Item(Item.ItemNamespace itemNamespace, java.lang.String itemId)
Item with an id but no payload. This is a valid item for nodes which are configured
so that ConfigureFormReader.isDeliverPayloads() is false.itemNamespace - the namespace of the item.itemId - The id if the item. It must be unique within the node unless overwriting and existing item.
Passing null is the equivalent of calling Item().public Item(java.lang.String itemId,
java.lang.String nodeId)
Item with an id and a node id.
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 the item.nodeId - The id of the node which the item was published to.public Item(Item.ItemNamespace itemNamespace, java.lang.String itemId, java.lang.String nodeId)
Item with an id and a node id.
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 the item.nodeId - The id of the node which the item was published to.public java.lang.String getId()
protected void addXml(org.jivesoftware.smack.util.XmlStringBuilder xml)
addXml in class NodeExtensionpublic java.lang.String toString()
toString in class NodeExtension