Skip to content

Commit 0f59dc7

Browse files
thussJakeWharton
authored andcommitted
Updated strict to be final so that the converter isn't mutable
1 parent 478e1dd commit 0f59dc7

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

retrofit-converters/simplexml/src/main/java/retrofit/converter/SimpleXMLConverter.java

+13-8
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,29 @@
1818
* @author Fabien Ric ([email protected])
1919
*/
2020
public class SimpleXMLConverter implements Converter {
21+
private static final boolean DEFAULT_STRICT = true;
2122
private static final String CHARSET = "UTF-8";
2223
private static final String MIME_TYPE = "application/xml; charset=" + CHARSET;
2324

2425
private final Serializer serializer;
2526

26-
private boolean strict = true;
27+
private final boolean strict;
2728

2829
public SimpleXMLConverter() {
29-
this(new Persister());
30+
this(DEFAULT_STRICT);
31+
}
32+
33+
public SimpleXMLConverter(boolean strict) {
34+
this(new Persister(), strict);
3035
}
3136

3237
public SimpleXMLConverter(Serializer serializer) {
38+
this(serializer, DEFAULT_STRICT);
39+
}
40+
41+
public SimpleXMLConverter(Serializer serializer, boolean strict) {
3342
this.serializer = serializer;
43+
this.strict = strict;
3444
}
3545

3646
@Override public Object fromBody(TypedInput body, Type type) throws ConversionException {
@@ -64,11 +74,6 @@ public SimpleXMLConverter(Serializer serializer) {
6474
}
6575

6676
public boolean isStrict() {
67-
return strict;
77+
return strict;
6878
}
69-
70-
public void setStrict(boolean strict) {
71-
this.strict = strict;
72-
}
73-
7479
}

0 commit comments

Comments
 (0)