mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-22 20:47:57 +01:00
Deprecate DataForm.Builder.setType()
This commit is contained in:
parent
070aa8e28e
commit
bda3901910
3 changed files with 12 additions and 4 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue