public class Item extends NodeExtension
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 PayloadItem.getPayload()
method, you can
add a custom parser as explained in ItemProvider
.
Constructor and Description |
---|
Item()
Create an empty Item with no id.
|
Item(String itemId)
Create an Item with an id but no payload.
|
Item(String itemId,
String nodeId)
Create an Item with an id and a node id.
|
Modifier and Type | Method and Description |
---|---|
String |
getId()
Get the item id.
|
String |
getNamespace()
Returns the root element XML namespace.
|
String |
toString() |
String |
toXML()
Returns the XML representation of this Element.
|
getElementName, getNode
public Item()
ConfigureForm.isDeliverPayloads()
is false. In most cases an id will be generated by the server.
For nodes configured with ConfigureForm.isDeliverPayloads()
and ConfigureForm.isPersistItems()
set to false, no Item is sent to the node, you have to use LeafNode.send()
or LeafNode.publish()
methods in this case.public Item(String itemId)
ConfigureForm.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(String itemId, String nodeId)
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 String getId()
public String getNamespace()
ExtensionElement
getNamespace
in interface ExtensionElement
getNamespace
in class NodeExtension
public String toXML()
Element
toXML
in interface Element
toXML
in class NodeExtension
public String toString()
toString
in class NodeExtension