1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-24 11:38:00 +01:00

[xdata] Rename FormReader.read(String) to getField(String)

Now that FormWriter, with its write() method, is gone, there is no
reason the FormReader method should still be named read(). Renaming to
getField() as this is what DataForm also uses.
This commit is contained in:
Florian Schmaus 2020-05-14 17:11:51 +02:00
parent d6c1018b47
commit c5212c20b6
4 changed files with 11 additions and 15 deletions

View file

@ -90,7 +90,7 @@ public interface ConfigureFormReader extends FormReader {
* @return List of the whitelist
*/
default List<Jid> getChildrenAssociationWhitelist() {
FormField formField = read(ConfigureNodeFields.children_association_whitelist.getFieldName());
FormField formField = getField(ConfigureNodeFields.children_association_whitelist.getFieldName());
if (formField == null) {
Collections.emptyList();
}

View file

@ -243,13 +243,13 @@ public class FillableForm extends FilledForm {
}
@Override
public FormField read(String fieldName) {
public FormField getField(String fieldName) {
FormField filledField = filledFields.get(fieldName);
if (filledField != null) {
return filledField;
}
return super.read(fieldName);
return super.getField(fieldName);
}
public DataForm getDataFormToSubmit() {

View file

@ -43,7 +43,7 @@ public abstract class FilledForm implements FormReader {
}
@Override
public FormField read(String fieldName) {
public FormField getField(String fieldName) {
return dataForm.getField(fieldName);
}
@ -74,10 +74,6 @@ public abstract class FilledForm implements FormReader {
return dataForm.hasField(fieldName);
}
public FormField getField(String fieldName) {
return dataForm.getField(fieldName);
}
protected FormField getFieldOrThrow(String fieldName) {
FormField formField = getField(fieldName);
if (formField == null) {

View file

@ -30,10 +30,10 @@ import org.jxmpp.util.XmppDateTime;
public interface FormReader {
FormField read(String fieldName);
FormField getField(String fieldName);
default String readFirstValue(String fieldName) {
FormField formField = read(fieldName);
FormField formField = getField(fieldName);
if (formField == null) {
return null;
}
@ -41,7 +41,7 @@ public interface FormReader {
}
default List<? extends CharSequence> readValues(String fieldName) {
FormField formField = read(fieldName);
FormField formField = getField(fieldName);
if (formField == null) {
return Collections.emptyList();
}
@ -49,7 +49,7 @@ public interface FormReader {
}
default List<String> readStringValues(String fieldName) {
FormField formField = read(fieldName);
FormField formField = getField(fieldName);
if (formField == null) {
return Collections.emptyList();
}
@ -58,7 +58,7 @@ public interface FormReader {
}
default Boolean readBoolean(String fieldName) {
FormField formField = read(fieldName);
FormField formField = getField(fieldName);
if (formField == null) {
return null;
}
@ -67,7 +67,7 @@ public interface FormReader {
}
default Integer readInteger(String fieldName) {
FormField formField = read(fieldName);
FormField formField = getField(fieldName);
if (formField == null) {
return null;
}
@ -76,7 +76,7 @@ public interface FormReader {
}
default Date readDate(String fieldName) throws ParseException {
FormField formField = read(fieldName);
FormField formField = getField(fieldName);
if (formField == null) {
return null;
}