1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-14 15:01:07 +01:00

Fix minor codestyle issues

This commit is contained in:
Paul Schaub 2017-12-13 23:10:11 +01:00 committed by Florian Schmaus
parent 200f90ffdc
commit cb18056613
422 changed files with 1404 additions and 1444 deletions

View file

@ -34,8 +34,8 @@ import org.jivesoftware.smackx.xdata.packet.DataForm.Item;
*/
public class ReportedData {
private List<Column> columns = new ArrayList<Column>();
private List<Row> rows = new ArrayList<Row>();
private final List<Column> columns = new ArrayList<>();
private final List<Row> rows = new ArrayList<>();
private String title = "";
/**
@ -70,13 +70,11 @@ public class ReportedData {
// Add the rows to the report based on the form's items
for (Item item : dataForm.getItems()) {
List<Field> fieldList = new ArrayList<Field>(columns.size());
List<Field> fieldList = new ArrayList<>(columns.size());
for (FormField field : item.getFields()) {
// The field is created with all the values of the data form's field
List<String> values = new ArrayList<String>();
for (String value : field.getValues()) {
values.add(value);
}
List<String> values = new ArrayList<>();
values.addAll(field.getValues());
fieldList.add(new Field(field.getVariable(), values));
}
rows.add(new Row(fieldList));
@ -114,7 +112,7 @@ public class ReportedData {
* @return a List of the rows returned from a search.
*/
public List<Row> getRows() {
return Collections.unmodifiableList(new ArrayList<Row>(rows));
return Collections.unmodifiableList(new ArrayList<>(rows));
}
/**
@ -123,7 +121,7 @@ public class ReportedData {
* @return a List of the columns returned from a search.
*/
public List<Column> getColumns() {
return Collections.unmodifiableList(new ArrayList<Column>(columns));
return Collections.unmodifiableList(new ArrayList<>(columns));
}
@ -194,7 +192,7 @@ public class ReportedData {
}
public static class Row {
private List<Field> fields = new ArrayList<Field>();
private List<Field> fields = new ArrayList<>();
public Row(List<Field> fields) {
this.fields = fields;
@ -221,13 +219,13 @@ public class ReportedData {
* @return the fields that define the data that goes with the item.
*/
private List<Field> getFields() {
return Collections.unmodifiableList(new ArrayList<Field>(fields));
return Collections.unmodifiableList(new ArrayList<>(fields));
}
}
public static class Field {
private String variable;
private List<String> values;
private final String variable;
private final List<String> values;
public Field(String variable, List<String> values) {
this.variable = variable;

View file

@ -99,11 +99,11 @@ class SimpleUserSearch extends IQ {
boolean done = false;
List<ReportedData.Field> fields = new ArrayList<ReportedData.Field>();
List<ReportedData.Field> fields = new ArrayList<>();
while (!done) {
if (parser.getAttributeCount() > 0) {
String jid = parser.getAttributeValue("", "jid");
List<String> valueList = new ArrayList<String>();
List<String> valueList = new ArrayList<>();
valueList.add(jid);
ReportedData.Field field = new ReportedData.Field("jid", valueList);
fields.add(field);
@ -112,7 +112,7 @@ class SimpleUserSearch extends IQ {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG && parser.getName().equals("item")) {
fields = new ArrayList<ReportedData.Field>();
fields = new ArrayList<>();
}
else if (eventType == XmlPullParser.END_TAG && parser.getName().equals("item")) {
ReportedData.Row row = new ReportedData.Row(fields);
@ -122,7 +122,7 @@ class SimpleUserSearch extends IQ {
String name = parser.getName();
String value = parser.nextText();
List<String> valueList = new ArrayList<String>();
List<String> valueList = new ArrayList<>();
valueList.add(value);
ReportedData.Field field = new ReportedData.Field(name, valueList);
fields.add(field);

View file

@ -70,7 +70,7 @@ public class UserSearch extends SimpleIQ {
search.setType(IQ.Type.get);
search.setTo(searchService);
IQ response = (IQ) con.createStanzaCollectorAndSend(search).nextResultOrThrow();
IQ response = con.createStanzaCollectorAndSend(search).nextResultOrThrow();
return Form.getFormFrom(response);
}
@ -92,7 +92,7 @@ public class UserSearch extends SimpleIQ {
search.setTo(searchService);
search.addExtension(searchForm.getDataFormToSend());
IQ response = (IQ) con.createStanzaCollectorAndSend(search).nextResultOrThrow();
IQ response = con.createStanzaCollectorAndSend(search).nextResultOrThrow();
return ReportedData.getReportedDataFrom(response);
}
@ -114,7 +114,7 @@ public class UserSearch extends SimpleIQ {
search.setType(IQ.Type.set);
search.setTo(searchService);
SimpleUserSearch response = (SimpleUserSearch) con.createStanzaCollectorAndSend(search).nextResultOrThrow();
SimpleUserSearch response = con.createStanzaCollectorAndSend(search).nextResultOrThrow();
return response.getReportedData();
}

View file

@ -48,8 +48,8 @@ import org.jxmpp.jid.DomainBareJid;
*/
public class UserSearchManager {
private XMPPConnection con;
private UserSearch userSearch;
private final XMPPConnection con;
private final UserSearch userSearch;
/**
* Creates a new UserSearchManager.