mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-01 01:35:59 +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
|
* @author Robin Collier
|
||||||
*/
|
*/
|
||||||
abstract public class EmbeddedExtensionProvider<PE extends PacketExtension> extends PacketExtensionProvider<PE>
|
public abstract class EmbeddedExtensionProvider<PE extends PacketExtension> extends PacketExtensionProvider<PE> {
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
final public PE parse(XmlPullParser parser, int initialDepth)
|
public final PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException,
|
||||||
throws XmlPullParserException, IOException, SmackException {
|
SmackException {
|
||||||
String namespace = parser.getNamespace();
|
final String namespace = parser.getNamespace();
|
||||||
String name = parser.getName();
|
final String name = parser.getName();
|
||||||
Map<String, String> attMap = new HashMap<String, String>();
|
final int attributeCount = parser.getAttributeCount();
|
||||||
|
Map<String, String> attMap = new HashMap<>(attributeCount);
|
||||||
|
|
||||||
for(int i=0; i<parser.getAttributeCount(); i++)
|
for (int i = 0; i < attributeCount; i++) {
|
||||||
{
|
attMap.put(parser.getAttributeName(i), parser.getAttributeValue(i));
|
||||||
attMap.put(parser.getAttributeName(i), parser.getAttributeValue(i));
|
|
||||||
}
|
}
|
||||||
List<PacketExtension> extensions = new ArrayList<PacketExtension>();
|
|
||||||
|
|
||||||
int tag;
|
List<PacketExtension> extensions = new ArrayList<>();
|
||||||
do
|
int event;
|
||||||
{
|
do {
|
||||||
tag = parser.next();
|
event = parser.next();
|
||||||
|
|
||||||
if (tag == XmlPullParser.START_TAG)
|
if (event == XmlPullParser.START_TAG)
|
||||||
PacketParserUtils.addPacketExtension(extensions, parser);
|
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