mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 00:02:06 +01:00
Cleanup EmbeddedExtensionProvider
- Change method modifiers keyword order to JLS - Use attributecount when creating the HashMap - Rename 'tag' to event' - Use diamond operator - Use Smack formatting style
This commit is contained in:
parent
a87323cc33
commit
06add179ec
1 changed files with 21 additions and 21 deletions
|
@ -81,33 +81,33 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
abstract public class EmbeddedExtensionProvider<PE extends PacketExtension> extends PacketExtensionProvider<PE>
|
||||
{
|
||||
public abstract class EmbeddedExtensionProvider<PE extends PacketExtension> extends PacketExtensionProvider<PE> {
|
||||
|
||||
@Override
|
||||
final public PE parse(XmlPullParser parser, int initialDepth)
|
||||
throws XmlPullParserException, IOException, SmackException {
|
||||
String namespace = parser.getNamespace();
|
||||
String name = parser.getName();
|
||||
Map<String, String> attMap = new HashMap<String, String>();
|
||||
|
||||
for(int i=0; i<parser.getAttributeCount(); i++)
|
||||
{
|
||||
attMap.put(parser.getAttributeName(i), parser.getAttributeValue(i));
|
||||
public final PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException,
|
||||
SmackException {
|
||||
final String namespace = parser.getNamespace();
|
||||
final String name = parser.getName();
|
||||
final int attributeCount = parser.getAttributeCount();
|
||||
Map<String, String> attMap = new HashMap<>(attributeCount);
|
||||
|
||||
for (int i = 0; i < attributeCount; i++) {
|
||||
attMap.put(parser.getAttributeName(i), parser.getAttributeValue(i));
|
||||
}
|
||||
List<PacketExtension> extensions = new ArrayList<PacketExtension>();
|
||||
|
||||
int tag;
|
||||
do
|
||||
{
|
||||
tag = parser.next();
|
||||
List<PacketExtension> extensions = new ArrayList<>();
|
||||
int event;
|
||||
do {
|
||||
event = parser.next();
|
||||
|
||||
if (tag == XmlPullParser.START_TAG)
|
||||
if (event == XmlPullParser.START_TAG)
|
||||
PacketParserUtils.addPacketExtension(extensions, parser);
|
||||
} while (!(tag == XmlPullParser.END_TAG && parser.getDepth() == initialDepth));
|
||||
}
|
||||
while (!(event == XmlPullParser.END_TAG && parser.getDepth() == initialDepth));
|
||||
|
||||
return createReturnExtension(name, namespace, attMap, extensions);
|
||||
}
|
||||
return createReturnExtension(name, namespace, attMap, extensions);
|
||||
}
|
||||
|
||||
abstract protected PE createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content);
|
||||
protected abstract PE createReturnExtension(String currentElement, String currentNamespace,
|
||||
Map<String, String> attributeMap, List<? extends PacketExtension> content);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue