Javadoc improvements.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2048 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2003-08-20 15:32:40 +00:00 committed by mtucker
parent f6676a616f
commit 83275fa888
1 changed files with 24 additions and 7 deletions

View File

@ -71,10 +71,11 @@ import java.util.Hashtable;
*/ */
public class PrivateDataManager { public class PrivateDataManager {
/**
* Map of provider instances.
*/
private static Map privateDataProviders = new Hashtable(); private static Map privateDataProviders = new Hashtable();
private XMPPConnection con;
/** /**
* Returns the private data provider registered to the specified XML element name and namespace. * Returns the private data provider registered to the specified XML element name and namespace.
* For example, if a provider was registered to the element name "prefs" and the * For example, if a provider was registered to the element name "prefs" and the
@ -117,6 +118,9 @@ public class PrivateDataManager {
privateDataProviders.put(key, provider); privateDataProviders.put(key, provider);
} }
private XMPPConnection con;
/** /**
* Creates a new private data manager. * Creates a new private data manager.
* *
@ -127,12 +131,17 @@ public class PrivateDataManager {
} }
/** /**
* Returns the private data specified by the given element name and namespace. * Returns the private data specified by the given element name and namespace. Each chunk
* of private data is uniquely identified by an element name and namespace pair.<p>
*
* If a PrivateDataProvider is registered for the specified element name/namespace pair then
* that provider will determine the specific object type that is returned. If no provider
* is registered, a {@link DefaultPrivateData} instance will be returned.
* *
* @param elementName the element name. * @param elementName the element name.
* @param namespace the namespace. * @param namespace the namespace.
* @return the private data. * @return the private data.
* @throws XMPPException * @throws XMPPException if an error occurs getting the private data.
*/ */
public PrivateData getPrivateData(final String elementName, final String namespace) public PrivateData getPrivateData(final String elementName, final String namespace)
throws XMPPException throws XMPPException
@ -168,6 +177,14 @@ public class PrivateDataManager {
return ((PrivateDataResult)response).getPrivateData(); return ((PrivateDataResult)response).getPrivateData();
} }
/**
* Sets a private data value. Each chunk of private data is uniquely identified by an
* element name and namespace pair. If private data has already been set with the
* element name and namespace, then the new private data will overwrite the old value.
*
* @param privateData the private data.
* @throws XMPPException if setting the private data fails.
*/
public void setPrivateData(final PrivateData privateData) throws XMPPException { public void setPrivateData(final PrivateData privateData) throws XMPPException {
// Create an IQ packet to set the private data. // Create an IQ packet to set the private data.
IQ privateDataSet = new IQ() { IQ privateDataSet = new IQ() {
@ -278,8 +295,8 @@ public class PrivateDataManager {
} }
} }
private static PrivateData parseWithIntrospection(String elementName, private static PrivateData parseWithIntrospection(String elementName, Class objectClass,
Class objectClass, XmlPullParser parser) throws Exception XmlPullParser parser) throws Exception
{ {
boolean done = false; boolean done = false;
PrivateData object = (PrivateData)objectClass.newInstance(); PrivateData object = (PrivateData)objectClass.newInstance();