mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +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() {
|
private static DataForm createDefaultInitiationForm() {
|
||||||
DataForm.Builder form = DataForm.builder()
|
DataForm.Builder form = DataForm.builder(DataForm.Type.form);
|
||||||
.setType(DataForm.Type.form);
|
|
||||||
ListSingleFormField.Builder fieldBuilder = FormField.listSingleBuilder(STREAM_DATA_FIELD_NAME);
|
ListSingleFormField.Builder fieldBuilder = FormField.listSingleBuilder(STREAM_DATA_FIELD_NAME);
|
||||||
|
|
||||||
if (!IBB_ONLY) {
|
if (!IBB_ONLY) {
|
||||||
|
|
|
@ -353,6 +353,7 @@ public final class DataForm implements ExtensionElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
|
// TODO: Make this field final once setType() is gone.
|
||||||
private Type type;
|
private Type type;
|
||||||
private String title;
|
private String title;
|
||||||
private List<String> instructions;
|
private List<String> instructions;
|
||||||
|
@ -381,6 +382,15 @@ public final class DataForm implements ExtensionElement {
|
||||||
extensionElements = CollectionUtil.newListWith(dataForm.getExtensionElements());
|
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) {
|
public Builder setType(Type type) {
|
||||||
this.type = Objects.requireNonNull(type);
|
this.type = Objects.requireNonNull(type);
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -66,8 +66,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
|
||||||
@Override
|
@Override
|
||||||
public DataForm parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
public DataForm parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||||
DataForm.Type dataFormType = DataForm.Type.fromString(parser.getAttributeValue("", "type"));
|
DataForm.Type dataFormType = DataForm.Type.fromString(parser.getAttributeValue("", "type"));
|
||||||
DataForm.Builder dataForm = DataForm.builder();
|
DataForm.Builder dataForm = DataForm.builder(dataFormType);
|
||||||
dataForm.setType(dataFormType);
|
|
||||||
|
|
||||||
String formType = null;
|
String formType = null;
|
||||||
DataForm.ReportedData reportedData = null;
|
DataForm.ReportedData reportedData = null;
|
||||||
|
|
Loading…
Reference in a new issue