|
Smack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jivesoftware.smackx.packet.DefaultPrivateData
public class DefaultPrivateData
Default implementation of the PrivateData interface. Unless a PrivateDataProvider is registered with the PrivateDataManager class, instances of this class will be returned when getting private data.
This class provides a very simple representation of an XML sub-document. Each element is a key in a Map with its CDATA being the value. For example, given the following XML sub-document:
<foo xmlns="http://bar.com"> <color>blue</color> <food>pizza</food> </foo>In this case, getValue("color") would return "blue", and getValue("food") would return "pizza". This parsing mechanism mechanism is very simplistic and will not work as desired in all cases (for example, if some of the elements have attributes. In those cases, a custom
PrivateDataProvider
should be used.
Constructor Summary | |
---|---|
DefaultPrivateData(String elementName,
String namespace)
Creates a new generic private data object. |
Method Summary | |
---|---|
String |
getElementName()
Returns the XML element name of the private data sub-packet root element. |
Iterator |
getNames()
Returns an Iterator for the names that can be used to get values of the private data. |
String |
getNamespace()
Returns the XML namespace of the private data sub-packet root element. |
String |
getValue(String name)
Returns a value given a name. |
void |
setValue(String name,
String value)
Sets a value given the name. |
String |
toXML()
Returns the XML reppresentation of the PrivateData. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultPrivateData(String elementName, String namespace)
elementName
- the name of the element of the XML sub-document.namespace
- the namespace of the element.Method Detail |
---|
public String getElementName()
getElementName
in interface PrivateData
public String getNamespace()
getNamespace
in interface PrivateData
public String toXML()
PrivateData
toXML
in interface PrivateData
public Iterator getNames()
public String getValue(String name)
name
- the name.
public void setValue(String name, String value)
name
- the name.value
- the value.
|
Smack | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |