1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +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 * @return List of the whitelist
*/ */
default List<Jid> getChildrenAssociationWhitelist() { default List<Jid> getChildrenAssociationWhitelist() {
FormField formField = read(ConfigureNodeFields.children_association_whitelist.getFieldName()); FormField formField = getField(ConfigureNodeFields.children_association_whitelist.getFieldName());
if (formField == null) { if (formField == null) {
Collections.emptyList(); Collections.emptyList();
} }

View file

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

View file

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

View file

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