1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

Refer to static fields by their declaring type

This commit is contained in:
Florian Schmaus 2020-04-12 12:08:31 +02:00
parent 0479a75d1d
commit 9879dea0bf
5 changed files with 18 additions and 13 deletions

View file

@ -28,6 +28,7 @@ import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.hashes.element.HashElement; import org.jivesoftware.smackx.hashes.element.HashElement;
import org.jivesoftware.smackx.hashes.provider.HashElementProvider; import org.jivesoftware.smackx.hashes.provider.HashElementProvider;
import org.jivesoftware.smackx.jingle.element.JingleContentDescription;
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement; import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionChildElement;
import org.jivesoftware.smackx.jingle.provider.JingleContentDescriptionProvider; import org.jivesoftware.smackx.jingle.provider.JingleContentDescriptionProvider;
import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer; import org.jivesoftware.smackx.jingle_filetransfer.element.JingleFileTransfer;
@ -101,7 +102,7 @@ public class JingleFileTransferProvider
builder = JingleFileTransferChild.getBuilder(); builder = JingleFileTransferChild.getBuilder();
break; break;
case JingleFileTransfer.ELEMENT: case JingleContentDescription.ELEMENT:
return new JingleFileTransfer(payloads); return new JingleFileTransfer(payloads);
} }
break; break;

View file

@ -32,6 +32,7 @@ import org.jivesoftware.smackx.message_markup.element.BlockQuoteElement;
import org.jivesoftware.smackx.message_markup.element.CodeBlockElement; import org.jivesoftware.smackx.message_markup.element.CodeBlockElement;
import org.jivesoftware.smackx.message_markup.element.ListElement; import org.jivesoftware.smackx.message_markup.element.ListElement;
import org.jivesoftware.smackx.message_markup.element.MarkupElement; import org.jivesoftware.smackx.message_markup.element.MarkupElement;
import org.jivesoftware.smackx.message_markup.element.MarkupElement.MarkupChildElement;
import org.jivesoftware.smackx.message_markup.element.SpanElement; import org.jivesoftware.smackx.message_markup.element.SpanElement;
public class MarkupElementProvider extends ExtensionElementProvider<MarkupElement> { public class MarkupElementProvider extends ExtensionElementProvider<MarkupElement> {
@ -55,26 +56,26 @@ public class MarkupElementProvider extends ExtensionElementProvider<MarkupElemen
case START_ELEMENT: case START_ELEMENT:
switch (name) { switch (name) {
case BlockQuoteElement.ELEMENT: case BlockQuoteElement.ELEMENT:
start = ParserUtils.getIntegerAttributeOrThrow(parser, BlockQuoteElement.ATTR_START, start = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
"Message Markup BlockQuoteElement MUST contain a 'start' attribute."); "Message Markup BlockQuoteElement MUST contain a 'start' attribute.");
end = ParserUtils.getIntegerAttributeOrThrow(parser, BlockQuoteElement.ATTR_END, end = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_END,
"Message Markup BlockQuoteElement MUST contain a 'end' attribute."); "Message Markup BlockQuoteElement MUST contain a 'end' attribute.");
markup.setBlockQuote(start, end); markup.setBlockQuote(start, end);
break; break;
case CodeBlockElement.ELEMENT: case CodeBlockElement.ELEMENT:
start = ParserUtils.getIntegerAttributeOrThrow(parser, CodeBlockElement.ATTR_START, start = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
"Message Markup CodeBlockElement MUST contain a 'start' attribute."); "Message Markup CodeBlockElement MUST contain a 'start' attribute.");
end = ParserUtils.getIntegerAttributeOrThrow(parser, CodeBlockElement.ATTR_END, end = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_END,
"Message Markup CodeBlockElement MUST contain a 'end' attribute."); "Message Markup CodeBlockElement MUST contain a 'end' attribute.");
markup.setCodeBlock(start, end); markup.setCodeBlock(start, end);
break; break;
case SpanElement.ELEMENT: case SpanElement.ELEMENT:
spanStyles = new HashSet<>(); spanStyles = new HashSet<>();
spanStart = ParserUtils.getIntegerAttributeOrThrow(parser, SpanElement.ATTR_START, spanStart = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
"Message Markup SpanElement MUST contain a 'start' attribute."); "Message Markup SpanElement MUST contain a 'start' attribute.");
spanEnd = ParserUtils.getIntegerAttributeOrThrow(parser, SpanElement.ATTR_END, spanEnd = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_END,
"Message Markup SpanElement MUST contain a 'end' attribute."); "Message Markup SpanElement MUST contain a 'end' attribute.");
break; break;
@ -92,14 +93,14 @@ public class MarkupElementProvider extends ExtensionElementProvider<MarkupElemen
case ListElement.ELEMENT: case ListElement.ELEMENT:
lis = new ArrayList<>(); lis = new ArrayList<>();
listStart = ParserUtils.getIntegerAttributeOrThrow(parser, ListElement.ATTR_START, listStart = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
"Message Markup ListElement MUST contain a 'start' attribute."); "Message Markup ListElement MUST contain a 'start' attribute.");
listEnd = ParserUtils.getIntegerAttributeOrThrow(parser, ListElement.ATTR_END, listEnd = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_END,
"Message Markup ListElement MUST contain a 'end' attribute."); "Message Markup ListElement MUST contain a 'end' attribute.");
break; break;
case ListElement.ELEM_LI: case ListElement.ELEM_LI:
start = ParserUtils.getIntegerAttributeOrThrow(parser, ListElement.ATTR_START, start = ParserUtils.getIntegerAttributeOrThrow(parser, MarkupChildElement.ATTR_START,
"Message Markup ListElement 'li' MUST contain a 'start' attribute."); "Message Markup ListElement 'li' MUST contain a 'start' attribute.");
lis.add(new ListElement.ListEntryElement(start)); lis.add(new ListElement.ListEntryElement(start));
break; break;

View file

@ -21,6 +21,7 @@ import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.sid.element.OriginIdElement; import org.jivesoftware.smackx.sid.element.OriginIdElement;
import org.jivesoftware.smackx.sid.element.StableAndUniqueIdElement;
public class OriginIdProvider extends ExtensionElementProvider<OriginIdElement> { public class OriginIdProvider extends ExtensionElementProvider<OriginIdElement> {
@ -32,6 +33,6 @@ public class OriginIdProvider extends ExtensionElementProvider<OriginIdElement>
@Override @Override
public OriginIdElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) { public OriginIdElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
return new OriginIdElement(parser.getAttributeValue(null, OriginIdElement.ATTR_ID)); return new OriginIdElement(parser.getAttributeValue(null, StableAndUniqueIdElement.ATTR_ID));
} }
} }

View file

@ -20,6 +20,7 @@ import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smackx.sid.element.StableAndUniqueIdElement;
import org.jivesoftware.smackx.sid.element.StanzaIdElement; import org.jivesoftware.smackx.sid.element.StanzaIdElement;
public class StanzaIdProvider extends ExtensionElementProvider<StanzaIdElement> { public class StanzaIdProvider extends ExtensionElementProvider<StanzaIdElement> {
@ -28,7 +29,7 @@ public class StanzaIdProvider extends ExtensionElementProvider<StanzaIdElement>
@Override @Override
public StanzaIdElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) { public StanzaIdElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) {
String id = parser.getAttributeValue(null, StanzaIdElement.ATTR_ID); String id = parser.getAttributeValue(null, StableAndUniqueIdElement.ATTR_ID);
String by = parser.getAttributeValue(null, StanzaIdElement.ATTR_BY); String by = parser.getAttributeValue(null, StanzaIdElement.ATTR_BY);
return new StanzaIdElement(id, by); return new StanzaIdElement(id, by);
} }

View file

@ -32,6 +32,7 @@ import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.jingle.element.JingleContentTransport; import org.jivesoftware.smackx.jingle.element.JingleContentTransport;
import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidate;
import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider; import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport; import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport;
import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate; import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate;
@ -66,7 +67,7 @@ public class JingleS5BTransportProvider extends JingleContentTransportProvider<J
case START_ELEMENT: { case START_ELEMENT: {
switch (name) { switch (name) {
case JingleS5BTransportCandidate.ELEMENT: case JingleContentTransportCandidate.ELEMENT:
cb = JingleS5BTransportCandidate.getBuilder(); cb = JingleS5BTransportCandidate.getBuilder();
cb.setCandidateId(parser.getAttributeValue(null, ATTR_CID)); cb.setCandidateId(parser.getAttributeValue(null, ATTR_CID));
cb.setHost(parser.getAttributeValue(null, ATTR_HOST)); cb.setHost(parser.getAttributeValue(null, ATTR_HOST));