1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 02:27:58 +01:00

Deprecate DataForm.Builder.setType()

This commit is contained in:
Florian Schmaus 2021-01-29 20:17:30 +01:00
parent 070aa8e28e
commit bda3901910
3 changed files with 12 additions and 4 deletions

View file

@ -360,8 +360,7 @@ public final class FileTransferNegotiator extends Manager {
}
private static DataForm createDefaultInitiationForm() {
DataForm.Builder form = DataForm.builder()
.setType(DataForm.Type.form);
DataForm.Builder form = DataForm.builder(DataForm.Type.form);
ListSingleFormField.Builder fieldBuilder = FormField.listSingleBuilder(STREAM_DATA_FIELD_NAME);
if (!IBB_ONLY) {

View file

@ -353,6 +353,7 @@ public final class DataForm implements ExtensionElement {
}
public static final class Builder {
// TODO: Make this field final once setType() is gone.
private Type type;
private String title;
private List<String> instructions;
@ -381,6 +382,15 @@ public final class DataForm implements ExtensionElement {
extensionElements = CollectionUtil.newListWith(dataForm.getExtensionElements());
}
/**
* Deprecated do not use.
*
* @param type the type.
* @return a reference to this builder.
* @deprecated use {@link DataForm#builder(Type)} instead.
*/
@Deprecated
// TODO: Remove in Smack 4.5 and then make this.type final.
public Builder setType(Type type) {
this.type = Objects.requireNonNull(type);
return this;

View file

@ -66,8 +66,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
@Override
public DataForm parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
DataForm.Type dataFormType = DataForm.Type.fromString(parser.getAttributeValue("", "type"));
DataForm.Builder dataForm = DataForm.builder();
dataForm.setType(dataFormType);
DataForm.Builder dataForm = DataForm.builder(dataFormType);
String formType = null;
DataForm.ReportedData reportedData = null;