Skip to content

Commit fe7fab8

Browse files
committed
Renaming all Json* to JSON*
1 parent 4669634 commit fe7fab8

5 files changed

Lines changed: 48 additions & 48 deletions

File tree

config/findbugs-exclude.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</Match>
55

66
<Match>
7-
<Class name="org.bson.JsonWriterSettings"/>
7+
<Class name="org.bson.JSONWriterSettings"/>
88
</Match>
99

1010
<Match>

driver/src/main/org/mongodb/json/JsonOutputMode.java renamed to driver/src/main/org/mongodb/json/JSONOutputMode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
package org.mongodb.json;
1818

1919
/**
20-
* An enumeration of the supported output modes of {@code JsonWriter}. The first three correspond to the syntax documented
20+
* An enumeration of the supported output modes of {@code JSONWriter}. The first three correspond to the syntax documented
2121
* <a href="http://www.mongodb.org/display/DOCS/Mongo+Extended+JSON">here</a>.
2222
*
23-
* @see JsonWriter
23+
* @see JSONWriter
2424
* @since 3.0.0
2525
*/
26-
public enum JsonOutputMode {
26+
public enum JSONOutputMode {
2727

2828
/**
2929
* Strict mode produces output conforming to the <a href="http://www.json.org">JSON RFC spec</a>.

driver/src/main/org/mongodb/json/JsonWriter.java renamed to driver/src/main/org/mongodb/json/JSONWriter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@
3535
*
3636
* @since 3.0.0
3737
*/
38-
public class JsonWriter extends BSONWriter {
38+
public class JSONWriter extends BSONWriter {
3939
private final Writer writer;
4040
private Context context;
41-
private final JsonWriterSettings settings;
41+
private final JSONWriterSettings settings;
4242

43-
public JsonWriter(final Writer writer) {
44-
this(writer, new JsonWriterSettings());
43+
public JSONWriter(final Writer writer) {
44+
this(writer, new JSONWriterSettings());
4545
}
4646

47-
public JsonWriter(final Writer writer, final JsonWriterSettings settings) {
47+
public JSONWriter(final Writer writer, final JSONWriterSettings settings) {
4848
super(settings);
4949
this.settings = settings;
5050
this.writer = writer;
@@ -199,7 +199,7 @@ public void writeDateTime(final long value) {
199199
}
200200
break;
201201
default:
202-
throw new BSONException("Unexpected JsonOutputMode.");
202+
throw new BSONException("Unexpected JSONOutputMode.");
203203
}
204204

205205
setState(getNextState());
@@ -436,7 +436,7 @@ private State getNextState() {
436436
private void writeNameHelper(final String name) throws IOException {
437437
switch (context.contextType) {
438438
case ARRAY:
439-
// don't write Array element names in Json
439+
// don't write Array element names in JSON
440440
if (context.hasElements) {
441441
writer.write(", ");
442442
}

driver/src/main/org/mongodb/json/JsonWriterSettings.java renamed to driver/src/main/org/mongodb/json/JSONWriterSettings.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@
2020
import org.mongodb.annotations.Immutable;
2121

2222
/**
23-
* Settings to control the behavior of a {@code JsonWriter} instance.
23+
* Settings to control the behavior of a {@code JSONWriter} instance.
2424
*
25-
* @see JsonWriter
25+
* @see JSONWriter
2626
* @since 3.0.0
2727
*/
2828
@Immutable
29-
public class JsonWriterSettings extends BSONWriterSettings {
29+
public class JSONWriterSettings extends BSONWriterSettings {
3030
private final boolean indent;
3131
private final String newLineCharacters;
3232
private final String indentCharacters;
33-
private final JsonOutputMode outputMode;
33+
private final JSONOutputMode outputMode;
3434

3535
/**
36-
* Builder to create an immutable instance of JsonWriterSettings
36+
* Builder to create an immutable instance of JSONWriterSettings
3737
* @since 3.0.0
3838
*/
3939
public final class Builder {
4040
private boolean indent;
4141
private String newLineCharacters;
4242
private String indentCharacters;
43-
private JsonOutputMode outputMode;
43+
private JSONOutputMode outputMode;
4444

4545
private Builder() {
4646
}
@@ -55,16 +55,16 @@ public Builder indented() {
5555
/**
5656
* Creates a new instance with default values for all properties.
5757
*/
58-
public JsonWriterSettings() {
59-
this(JsonOutputMode.Strict, false, null, null);
58+
public JSONWriterSettings() {
59+
this(JSONOutputMode.Strict, false, null, null);
6060
}
6161

6262
/**
6363
* Creates a new instance with the given output mode and default values for all other properties.
6464
*
6565
* @param outputMode the output mode
6666
*/
67-
public JsonWriterSettings(final JsonOutputMode outputMode) {
67+
public JSONWriterSettings(final JSONOutputMode outputMode) {
6868
this(outputMode, false, null, null);
6969
}
7070

@@ -73,8 +73,8 @@ public JsonWriterSettings(final JsonOutputMode outputMode) {
7373
*
7474
* @param indent whether indent mode is enabled
7575
*/
76-
public JsonWriterSettings(final boolean indent) {
77-
this(JsonOutputMode.Strict, true, " ", null);
76+
public JSONWriterSettings(final boolean indent) {
77+
this(JSONOutputMode.Strict, true, " ", null);
7878
}
7979

8080
/**
@@ -84,7 +84,7 @@ public JsonWriterSettings(final boolean indent) {
8484
* @param outputMode the output mode
8585
* @param indent whether indent mode is enabled
8686
*/
87-
public JsonWriterSettings(final JsonOutputMode outputMode, final boolean indent) {
87+
public JSONWriterSettings(final JSONOutputMode outputMode, final boolean indent) {
8888
this(outputMode, true, " ", null);
8989
}
9090

@@ -95,7 +95,7 @@ public JsonWriterSettings(final JsonOutputMode outputMode, final boolean indent)
9595
* @param outputMode the output mode
9696
* @param indentCharacters the indent characters
9797
*/
98-
public JsonWriterSettings(final JsonOutputMode outputMode, final String indentCharacters) {
98+
public JSONWriterSettings(final JSONOutputMode outputMode, final String indentCharacters) {
9999
this(outputMode, true, indentCharacters, null);
100100
}
101101

@@ -106,12 +106,12 @@ public JsonWriterSettings(final JsonOutputMode outputMode, final String indentCh
106106
* @param indentCharacters the indent characters
107107
* @param newLineCharacters the new line character(s) to use
108108
*/
109-
public JsonWriterSettings(final JsonOutputMode outputMode, final String indentCharacters,
109+
public JSONWriterSettings(final JSONOutputMode outputMode, final String indentCharacters,
110110
final String newLineCharacters) {
111111
this(outputMode, true, indentCharacters, newLineCharacters);
112112
}
113113

114-
private JsonWriterSettings(final JsonOutputMode outputMode, final boolean indent, final String indentCharacters,
114+
private JSONWriterSettings(final JSONOutputMode outputMode, final boolean indent, final String indentCharacters,
115115
final String newLineCharacters) {
116116
if (indent) {
117117
if (indentCharacters == null) {
@@ -166,11 +166,11 @@ public String getIndentCharacters() {
166166
}
167167

168168
/**
169-
* The output mode to use. The default value is {@code }JsonOutputMode.Strict}.
169+
* The output mode to use. The default value is {@code }JSONOutputMode.Strict}.
170170
*
171171
* @return the output mode.
172172
*/
173-
public JsonOutputMode getOutputMode() {
173+
public JSONOutputMode getOutputMode() {
174174
return outputMode;
175175
}
176176
}

driver/src/test/functional/org/mongodb/json/JsonWriterTest.java renamed to driver/src/test/functional/org/mongodb/json/JSONWriterTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
import static org.junit.Assert.assertEquals;
3232

3333
@SuppressWarnings("unchecked")
34-
public class JsonWriterTest {
34+
public class JSONWriterTest {
3535
private StringWriter stringWriter;
36-
private JsonWriter writer;
36+
private JSONWriter writer;
3737

3838
@Before
3939
public void before() {
4040
stringWriter = new StringWriter();
41-
writer = new JsonWriter(stringWriter, new JsonWriterSettings());
41+
writer = new JSONWriter(stringWriter, new JSONWriterSettings());
4242
}
4343

4444
private static class TestData<T> {
@@ -70,7 +70,7 @@ public void testSingleString() {
7070

7171
@Test
7272
public void testIndentedEmptyDocument() {
73-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(true));
73+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(true));
7474
writer.writeStartDocument();
7575
writer.writeEndDocument();
7676
final String expected = "{ }";
@@ -79,7 +79,7 @@ public void testIndentedEmptyDocument() {
7979

8080
@Test
8181
public void testIndentedOneElement() {
82-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(true));
82+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(true));
8383
writer.writeStartDocument();
8484
writer.writeString("name", "value");
8585
writer.writeEndDocument();
@@ -89,7 +89,7 @@ public void testIndentedOneElement() {
8989

9090
@Test
9191
public void testIndentedTwoElements() {
92-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(true));
92+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(true));
9393
writer.writeStartDocument();
9494
writer.writeString("a", "x");
9595
writer.writeString("b", "y");
@@ -126,7 +126,7 @@ public void testDouble() {
126126
new TestData<Double>(Double.POSITIVE_INFINITY, "Infinity"));
127127
for (final TestData<Double> cur : tests) {
128128
stringWriter = new StringWriter();
129-
writer = new JsonWriter(stringWriter, new JsonWriterSettings());
129+
writer = new JSONWriter(stringWriter, new JSONWriterSettings());
130130
writer.writeStartDocument();
131131
writer.writeDouble("d", cur.value);
132132
writer.writeEndDocument();
@@ -151,7 +151,7 @@ public void testInt64Shell() {
151151
"NumberLong(\"9223372036854775807\")"));
152152
for (final TestData<Long> cur : tests) {
153153
stringWriter = new StringWriter();
154-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Shell));
154+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Shell));
155155
writer.writeStartDocument();
156156
writer.writeInt64("l", cur.value);
157157
writer.writeEndDocument();
@@ -171,7 +171,7 @@ public void testInt64Strict() {
171171

172172
for (final TestData<Long> cur : tests) {
173173
stringWriter = new StringWriter();
174-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Strict));
174+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Strict));
175175
writer.writeStartDocument();
176176
writer.writeInt64("l", cur.value);
177177
writer.writeEndDocument();
@@ -195,7 +195,7 @@ public void testEmbeddedDocument() {
195195

196196
@Test
197197
public void testIndentedEmbeddedDocument() {
198-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(true));
198+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(true));
199199
writer.writeStartDocument();
200200
writer.writeStartDocument("doc");
201201
writer.writeInt32("a", 1);
@@ -238,7 +238,7 @@ public void testBinaryStrict() {
238238
+ "\"$type\" : \"a\" }"));
239239
for (final TestData<Binary> cur : tests) {
240240
stringWriter = new StringWriter();
241-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Strict));
241+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Strict));
242242
writer.writeStartDocument();
243243
writer.writeBinaryData("binary", cur.value);
244244
writer.writeEndDocument();
@@ -261,7 +261,7 @@ public void testBinaryShell() {
261261
"new BinData(a, \"AQID\")"));
262262
for (final TestData<Binary> cur : tests) {
263263
stringWriter = new StringWriter();
264-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Shell));
264+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Shell));
265265
writer.writeStartDocument();
266266
writer.writeBinaryData("binary", cur.value);
267267
writer.writeEndDocument();
@@ -279,7 +279,7 @@ public void testDateTimeStrict() {
279279
"{ \"$date\" : -9223372036854775808 }"));
280280
for (final TestData<Date> cur : tests) {
281281
stringWriter = new StringWriter();
282-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Strict));
282+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Strict));
283283
writer.writeStartDocument();
284284
writer.writeDateTime("date", cur.value.getTime());
285285
writer.writeEndDocument();
@@ -302,7 +302,7 @@ public void testDateTimeShell() {
302302
"new Date(-9223372036854775808)"));
303303
for (final TestData<Date> cur : tests) {
304304
stringWriter = new StringWriter();
305-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Shell));
305+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Shell));
306306
writer.writeStartDocument();
307307
writer.writeDateTime("date", cur.value.getTime());
308308
writer.writeEndDocument();
@@ -321,7 +321,7 @@ public void testDateTimeTenGen() {
321321
"new Date(-9223372036854775808)"));
322322
for (final TestData<Date> cur : tests) {
323323
stringWriter = new StringWriter();
324-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.TenGen));
324+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.TenGen));
325325
writer.writeStartDocument();
326326
writer.writeDateTime("date", cur.value.getTime());
327327
writer.writeEndDocument();
@@ -381,7 +381,7 @@ public void testNull() {
381381

382382
@Test
383383
public void testObjectIdShell() {
384-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Shell));
384+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Shell));
385385
final ObjectId objectId = new ObjectId("4d0ce088e447ad08b4721a37");
386386

387387
writer.writeStartDocument();
@@ -418,7 +418,7 @@ public void testRegularExpressionShell() {
418418
new TestData<RegularExpression>(new RegularExpression("a", "imxs"), "/a/imxs"));
419419
for (final TestData<RegularExpression> cur : tests) {
420420
stringWriter = new StringWriter();
421-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Shell));
421+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Shell));
422422
writer.writeStartDocument();
423423
writer.writeRegularExpression("regex", cur.value);
424424
writer.writeEndDocument();
@@ -460,7 +460,7 @@ public void testRegularExpressionStrict() {
460460
"{ \"$regex\" : \"a\"," + " \"$options\" : \"imxs\" }"));
461461
for (final TestData<RegularExpression> cur : tests) {
462462
stringWriter = new StringWriter();
463-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Strict));
463+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Strict));
464464
writer.writeStartDocument();
465465
writer.writeRegularExpression("regex", cur.value);
466466
writer.writeEndDocument();
@@ -485,7 +485,7 @@ public void testString() {
485485
new TestData<String>("\u0080\u0081\u0082", "\"\\u0080\\u0081\\u0082\""));
486486
for (final TestData<String> cur : tests) {
487487
stringWriter = new StringWriter();
488-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Strict));
488+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Strict));
489489
writer.writeStartDocument();
490490
writer.writeString("str", cur.value);
491491
writer.writeEndDocument();
@@ -515,7 +515,7 @@ public void testTimestampStrict() {
515515

516516
@Test
517517
public void testTimestampShell() {
518-
writer = new JsonWriter(stringWriter, new JsonWriterSettings(JsonOutputMode.Shell));
518+
writer = new JSONWriter(stringWriter, new JSONWriterSettings(JSONOutputMode.Shell));
519519
writer.writeStartDocument();
520520
writer.writeTimestamp("timestamp", new BSONTimestamp(1000, 1));
521521
writer.writeEndDocument();

0 commit comments

Comments
 (0)