Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber.extensions
Class DefaultPacketExtensionProvider<C extends AbstractPacketExtension>

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.jabber.extensions.DefaultPacketExtensionProvider<C>
Type Parameters:
C - Class that the packets we will be parsing belong to
All Implemented Interfaces:
org.jivesoftware.smack.provider.PacketExtensionProvider

public class DefaultPacketExtensionProvider<C extends AbstractPacketExtension>
extends Object
implements org.jivesoftware.smack.provider.PacketExtensionProvider

A provider that parses incoming packet extensions into instances of the Class that it has been instantiated for.

Author:
Emil Ivov

Constructor Summary
DefaultPacketExtensionProvider(Class<C> c)
          Creates a new packet provider for the specified packet extensions.
 
Method Summary
 C parseExtension(org.xmlpull.v1.XmlPullParser parser)
          Parse an extension sub-packet and create a C instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPacketExtensionProvider

public DefaultPacketExtensionProvider(Class<C> c)
Creates a new packet provider for the specified packet extensions.

Parameters:
c - the Class that the packets we will be parsing belong to.
Method Detail

parseExtension

public C parseExtension(org.xmlpull.v1.XmlPullParser parser)
                                                 throws Exception
Parse an extension sub-packet and create a C instance. At the beginning of the method call, the xml parser will be positioned on the opening element of the packet extension and at the end of the method call it will be on the closing element of the packet extension.

Specified by:
parseExtension in interface org.jivesoftware.smack.provider.PacketExtensionProvider
Parameters:
parser - an XML parser positioned at the packet's starting element.
Returns:
a new packet extension instance.
Throws:
Exception - if an error occurs parsing the XML.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.