Skip to content

Commit 8467ecc

Browse files
authored
Move JsonPatchDocument into the root util package (Azure#16614)
1 parent eb40bdd commit 8467ecc

File tree

9 files changed

+34
-47
lines changed

9 files changed

+34
-47
lines changed

sdk/core/azure-core/src/main/java/com/azure/core/util/jsonpatch/JsonPatchDocument.java renamed to sdk/core/azure-core/src/main/java/com/azure/core/util/JsonPatchDocument.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.core.util.jsonpatch;
4+
package com.azure.core.util;
55

6-
import com.azure.core.util.Option;
76
import com.azure.core.util.logging.ClientLogger;
87
import com.azure.core.util.serializer.JacksonAdapter;
98
import com.azure.core.util.serializer.JsonSerializer;
@@ -68,7 +67,7 @@ List<JsonPatchOperation> getOperations() {
6867
*
6968
* <p><strong>Code Samples</strong></p>
7069
*
71-
* {@codesnippet com.azure.core.util.jsonpatch.JsonPatchDocument.appendAdd#String-Object}
70+
* {@codesnippet com.azure.core.util.JsonPatchDocument.appendAdd#String-Object}
7271
*
7372
* @param path The path to apply the addition.
7473
* @param value The value that will be serialized and added to the path.
@@ -89,7 +88,7 @@ public JsonPatchDocument appendAdd(String path, Object value) {
8988
*
9089
* <p><strong>Code Samples</strong></p>
9190
*
92-
* {@codesnippet com.azure.core.util.jsonpatch.JsonPatchDocument.appendAddRaw#String-String}
91+
* {@codesnippet com.azure.core.util.JsonPatchDocument.appendAddRaw#String-String}
9392
*
9493
* @param path The path to apply the addition.
9594
* @param rawJson The raw JSON value that will be added to the path.
@@ -113,7 +112,7 @@ private JsonPatchDocument appendAddInternal(String path, Option<String> rawJsonO
113112
*
114113
* <p><strong>Code Samples</strong></p>
115114
*
116-
* {@codesnippet com.azure.core.util.jsonpatch.JsonPatchDocument.appendReplace#String-Object}
115+
* {@codesnippet com.azure.core.util.JsonPatchDocument.appendReplace#String-Object}
117116
*
118117
* @param path The path to replace.
119118
* @param value The value will be serialized and used as the replacement.
@@ -131,7 +130,7 @@ public JsonPatchDocument appendReplace(String path, Object value) {
131130
*
132131
* <p><strong>Code Samples</strong></p>
133132
*
134-
* {@codesnippet com.azure.core.util.jsonpatch.JsonPatchDocument.appendReplaceRaw#String-String}
133+
* {@codesnippet com.azure.core.util.JsonPatchDocument.appendReplaceRaw#String-String}
135134
*
136135
* @param path The path to replace.
137136
* @param rawJson The raw JSON value that will be used as the replacement.
@@ -155,7 +154,7 @@ private JsonPatchDocument appendReplaceInternal(String path, Option<String> rawJ
155154
*
156155
* <p><strong>Code Samples</strong></p>
157156
*
158-
* {@codesnippet com.azure.core.util.jsonpatch.JsonPatchDocument.appendCopy#String-String}
157+
* {@codesnippet com.azure.core.util.JsonPatchDocument.appendCopy#String-String}
159158
*
160159
* @param from The path to copy from.
161160
* @param path The path to copy to.
@@ -178,7 +177,7 @@ public JsonPatchDocument appendCopy(String from, String path) {
178177
*
179178
* <p><strong>Code Samples</strong></p>
180179
*
181-
* {@codesnippet com.azure.core.util.jsonpatch.JsonPatchDocument.appendMove#String-String}
180+
* {@codesnippet com.azure.core.util.JsonPatchDocument.appendMove#String-String}
182181
*
183182
* @param from The path to move from.
184183
* @param path The path to move to.
@@ -199,7 +198,7 @@ public JsonPatchDocument appendMove(String from, String path) {
199198
*
200199
* <p><strong>Code Samples</strong></p>
201200
*
202-
* {@codesnippet com.azure.core.util.jsonpatch.JsonPatchDocument.appendRemove#String}
201+
* {@codesnippet com.azure.core.util.JsonPatchDocument.appendRemove#String}
203202
*
204203
* @param path The path to remove.
205204
* @return The updated JsonPatchDocument object.
@@ -218,7 +217,7 @@ public JsonPatchDocument appendRemove(String path) {
218217
*
219218
* <p><strong>Code Samples</strong></p>
220219
*
221-
* {@codesnippet com.azure.core.util.jsonpatch.JsonPatchDocument.appendTest#String-Object}
220+
* {@codesnippet com.azure.core.util.JsonPatchDocument.appendTest#String-Object}
222221
*
223222
* @param path The path to test.
224223
* @param value The value that will be serialized and used to test against.
@@ -236,7 +235,7 @@ public JsonPatchDocument appendTest(String path, Object value) {
236235
*
237236
* <p><strong>Code Samples</strong></p>
238237
*
239-
* {@codesnippet com.azure.core.util.jsonpatch.JsonPatchDocument.appendTestRaw#String-String}
238+
* {@codesnippet com.azure.core.util.JsonPatchDocument.appendTestRaw#String-String}
240239
*
241240
* @param path The path to test.
242241
* @param rawJson The raw JSON value that will be used to test against.

sdk/core/azure-core/src/main/java/com/azure/core/util/jsonpatch/JsonPatchDocumentSerializer.java renamed to sdk/core/azure-core/src/main/java/com/azure/core/util/JsonPatchDocumentSerializer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.core.util.jsonpatch;
4+
package com.azure.core.util;
55

6-
import com.azure.core.util.CoreUtils;
76
import com.fasterxml.jackson.core.JsonGenerator;
87
import com.fasterxml.jackson.databind.JsonSerializer;
98
import com.fasterxml.jackson.databind.SerializerProvider;

sdk/core/azure-core/src/main/java/com/azure/core/util/jsonpatch/JsonPatchOperation.java renamed to sdk/core/azure-core/src/main/java/com/azure/core/util/JsonPatchOperation.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.core.util.jsonpatch;
4+
package com.azure.core.util;
55

6-
import com.azure.core.util.Option;
76
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
87

98
import java.util.Objects;

sdk/core/azure-core/src/main/java/com/azure/core/util/jsonpatch/JsonPatchOperationKind.java renamed to sdk/core/azure-core/src/main/java/com/azure/core/util/JsonPatchOperationKind.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.core.util.jsonpatch;
4+
package com.azure.core.util;
55

66
import com.fasterxml.jackson.annotation.JsonValue;
77

sdk/core/azure-core/src/main/java/com/azure/core/util/jsonpatch/JsonPatchOperationSerializer.java renamed to sdk/core/azure-core/src/main/java/com/azure/core/util/JsonPatchOperationSerializer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.core.util.jsonpatch;
4+
package com.azure.core.util;
55

6-
import com.azure.core.util.Option;
76
import com.fasterxml.jackson.core.JsonGenerator;
87
import com.fasterxml.jackson.databind.JsonSerializer;
98
import com.fasterxml.jackson.databind.SerializerProvider;

sdk/core/azure-core/src/main/java/com/azure/core/util/jsonpatch/package-info.java

Lines changed: 0 additions & 7 deletions
This file was deleted.

sdk/core/azure-core/src/main/java/module-info.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
exports com.azure.core.http.policy;
2323
exports com.azure.core.http.rest;
2424
exports com.azure.core.util;
25-
exports com.azure.core.util.jsonpatch;
2625
exports com.azure.core.util.logging;
2726
exports com.azure.core.util.paging;
2827
exports com.azure.core.util.polling;
@@ -32,7 +31,6 @@
3231
// exporting some packages specifically for Jackson
3332
opens com.azure.core.http to com.fasterxml.jackson.databind;
3433
opens com.azure.core.util to com.fasterxml.jackson.databind;
35-
opens com.azure.core.util.jsonpatch to com.fasterxml.jackson.databind;
3634
opens com.azure.core.util.logging to com.fasterxml.jackson.databind;
3735
opens com.azure.core.util.serializer to com.fasterxml.jackson.databind;
3836
opens com.azure.core.implementation to com.fasterxml.jackson.databind;

sdk/core/azure-core/src/samples/java/com/azure/core/util/jsonpatch/JsonPatchDocumentJavaDocCodeSnippet.java renamed to sdk/core/azure-core/src/samples/java/com/azure/core/util/JsonPatchDocumentJavaDocCodeSnippet.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.core.util.jsonpatch;
4+
package com.azure.core.util;
55

66
import java.util.Collections;
77

@@ -14,7 +14,7 @@ public class JsonPatchDocumentJavaDocCodeSnippet {
1414
*/
1515
public void appendAdd() {
1616
JsonPatchDocument jsonPatchDocument = new JsonPatchDocument();
17-
// BEGIN: com.azure.core.util.jsonpatch.JsonPatchDocument.appendAdd#String-Object
17+
// BEGIN: com.azure.core.util.JsonPatchDocument.appendAdd#String-Object
1818
/*
1919
* Add an object member to the JSON document { "foo" : "bar" } to get the JSON document
2020
* { "bar": "foo", "foo": "bar" }.
@@ -38,15 +38,15 @@ public void appendAdd() {
3838
* { "foo": [ "fizz", "buzz", "fizzbuzz" ] }.
3939
*/
4040
jsonPatchDocument.appendAdd("/foo/-", "fizzbuzz");
41-
// END: com.azure.core.util.jsonpatch.JsonPatchDocument.appendAdd#String-Object
41+
// END: com.azure.core.util.JsonPatchDocument.appendAdd#String-Object
4242
}
4343

4444
/**
4545
* Codesnippets for {@link JsonPatchDocument#appendAddRaw(String, String)}.
4646
*/
4747
public void appendAddRaw() {
4848
JsonPatchDocument jsonPatchDocument = new JsonPatchDocument();
49-
// BEGIN: com.azure.core.util.jsonpatch.JsonPatchDocument.appendAddRaw#String-String
49+
// BEGIN: com.azure.core.util.JsonPatchDocument.appendAddRaw#String-String
5050
/*
5151
* Add an object member to the JSON document { "foo" : "bar" } to get the JSON document
5252
* { "bar": "foo", "foo": "bar" }.
@@ -70,15 +70,15 @@ public void appendAddRaw() {
7070
* { "foo": [ "fizz", "buzz", "fizzbuzz" ] }.
7171
*/
7272
jsonPatchDocument.appendAddRaw("/foo/-", "\"fizzbuzz\"");
73-
// END: com.azure.core.util.jsonpatch.JsonPatchDocument.appendAddRaw#String-String
73+
// END: com.azure.core.util.JsonPatchDocument.appendAddRaw#String-String
7474
}
7575

7676
/**
7777
* Codesnippets for {@link JsonPatchDocument#appendReplace(String, Object)}.
7878
*/
7979
public void appendReplace() {
8080
JsonPatchDocument jsonPatchDocument = new JsonPatchDocument();
81-
// BEGIN: com.azure.core.util.jsonpatch.JsonPatchDocument.appendReplace#String-Object
81+
// BEGIN: com.azure.core.util.JsonPatchDocument.appendReplace#String-Object
8282
/*
8383
* Replace an object member in the JSON document { "bar": "qux", "foo": "bar" } to get the JSON document
8484
* { "bar": "foo", "foo": "bar" }.
@@ -96,15 +96,15 @@ public void appendReplace() {
9696
* target path doesn't exist in the document.
9797
*/
9898
jsonPatchDocument.appendReplace("/baz", "foo");
99-
// END: com.azure.core.util.jsonpatch.JsonPatchDocument.appendReplace#String-Object
99+
// END: com.azure.core.util.JsonPatchDocument.appendReplace#String-Object
100100
}
101101

102102
/**
103103
* Codesnippets for {@link JsonPatchDocument#appendReplaceRaw(String, String)}.
104104
*/
105105
public void appendReplaceRaw() {
106106
JsonPatchDocument jsonPatchDocument = new JsonPatchDocument();
107-
// BEGIN: com.azure.core.util.jsonpatch.JsonPatchDocument.appendReplaceRaw#String-String
107+
// BEGIN: com.azure.core.util.JsonPatchDocument.appendReplaceRaw#String-String
108108
/*
109109
* Replace an object member in the JSON document { "bar": "qux", "foo": "bar" } to get the JSON document
110110
* { "bar": "foo", "foo": "bar" }.
@@ -122,15 +122,15 @@ public void appendReplaceRaw() {
122122
* target path doesn't exist in the document.
123123
*/
124124
jsonPatchDocument.appendReplaceRaw("/baz", "\"foo\"");
125-
// END: com.azure.core.util.jsonpatch.JsonPatchDocument.appendReplaceRaw#String-String
125+
// END: com.azure.core.util.JsonPatchDocument.appendReplaceRaw#String-String
126126
}
127127

128128
/**
129129
* Codesnippets for {@link JsonPatchDocument#appendCopy(String, String)}.
130130
*/
131131
public void appendCopy() {
132132
JsonPatchDocument jsonPatchDocument = new JsonPatchDocument();
133-
// BEGIN: com.azure.core.util.jsonpatch.JsonPatchDocument.appendCopy#String-String
133+
// BEGIN: com.azure.core.util.JsonPatchDocument.appendCopy#String-String
134134
/*
135135
* Copy an object member in the JSON document { "foo": "bar" } to get the JSON document
136136
* { "foo": "bar", "copy": "bar" }.
@@ -148,15 +148,15 @@ public void appendCopy() {
148148
* target from doesn't exist in the document.
149149
*/
150150
jsonPatchDocument.appendCopy("/baz", "/fizz");
151-
// END: com.azure.core.util.jsonpatch.JsonPatchDocument.appendCopy#String-String
151+
// END: com.azure.core.util.JsonPatchDocument.appendCopy#String-String
152152
}
153153

154154
/**
155155
* Codesnippets for {@link JsonPatchDocument#appendMove(String, String)}.
156156
*/
157157
public void appendMove() {
158158
JsonPatchDocument jsonPatchDocument = new JsonPatchDocument();
159-
// BEGIN: com.azure.core.util.jsonpatch.JsonPatchDocument.appendMove#String-String
159+
// BEGIN: com.azure.core.util.JsonPatchDocument.appendMove#String-String
160160
/*
161161
* Move an object member in the JSON document { "foo": "bar", "bar": "foo" } to get the JSON document
162162
* { "bar": "bar" }.
@@ -180,15 +180,15 @@ public void appendMove() {
180180
* target from doesn't exist in the document.
181181
*/
182182
jsonPatchDocument.appendMove("/baz", "/fizz");
183-
// END: com.azure.core.util.jsonpatch.JsonPatchDocument.appendMove#String-String
183+
// END: com.azure.core.util.JsonPatchDocument.appendMove#String-String
184184
}
185185

186186
/**
187187
* Codesnippets for {@link JsonPatchDocument#appendRemove(String)}.
188188
*/
189189
public void appendRemove() {
190190
JsonPatchDocument jsonPatchDocument = new JsonPatchDocument();
191-
// BEGIN: com.azure.core.util.jsonpatch.JsonPatchDocument.appendRemove#String
191+
// BEGIN: com.azure.core.util.JsonPatchDocument.appendRemove#String
192192
/*
193193
* Remove an object member in the JSON document { "foo": "bar", "bar": "foo" } to get the JSON document
194194
* { "foo": "bar" }.
@@ -206,15 +206,15 @@ public void appendRemove() {
206206
* target from doesn't exist in the document.
207207
*/
208208
jsonPatchDocument.appendRemove("/baz");
209-
// END: com.azure.core.util.jsonpatch.JsonPatchDocument.appendRemove#String
209+
// END: com.azure.core.util.JsonPatchDocument.appendRemove#String
210210
}
211211

212212
/**
213213
* Codesnippets for {@link JsonPatchDocument#appendTest(String, Object)}.
214214
*/
215215
public void appendTest() {
216216
JsonPatchDocument jsonPatchDocument = new JsonPatchDocument();
217-
// BEGIN: com.azure.core.util.jsonpatch.JsonPatchDocument.appendTest#String-Object
217+
// BEGIN: com.azure.core.util.JsonPatchDocument.appendTest#String-Object
218218
/*
219219
* Test an object member in the JSON document { "foo": "bar" } to get a successful operation.
220220
*/
@@ -230,15 +230,15 @@ public void appendTest() {
230230
* the target path doesn't exist in the document.
231231
*/
232232
jsonPatchDocument.appendTest("/baz", "bar");
233-
// END: com.azure.core.util.jsonpatch.JsonPatchDocument.appendTest#String-Object
233+
// END: com.azure.core.util.JsonPatchDocument.appendTest#String-Object
234234
}
235235

236236
/**
237237
* Codesnippets for {@link JsonPatchDocument#appendTestRaw(String, String)}.
238238
*/
239239
public void appendTestRaw() {
240240
JsonPatchDocument jsonPatchDocument = new JsonPatchDocument();
241-
// BEGIN: com.azure.core.util.jsonpatch.JsonPatchDocument.appendTestRaw#String-String
241+
// BEGIN: com.azure.core.util.JsonPatchDocument.appendTestRaw#String-String
242242
/*
243243
* Test an object member in the JSON document { "foo": "bar" } to get a successful operation.
244244
*/
@@ -254,6 +254,6 @@ public void appendTestRaw() {
254254
* the target path doesn't exist in the document.
255255
*/
256256
jsonPatchDocument.appendTestRaw("/baz", "\"bar\"");
257-
// END: com.azure.core.util.jsonpatch.JsonPatchDocument.appendTestRaw#String-String
257+
// END: com.azure.core.util.JsonPatchDocument.appendTestRaw#String-String
258258
}
259259
}

sdk/core/azure-core/src/test/java/com/azure/core/util/jsonpatch/JsonPatchDocumentTests.java renamed to sdk/core/azure-core/src/test/java/com/azure/core/util/JsonPatchDocumentTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
package com.azure.core.util.jsonpatch;
4+
package com.azure.core.util;
55

66
import com.azure.core.util.serializer.JacksonAdapter;
77
import com.azure.core.util.serializer.JsonSerializer;

0 commit comments

Comments
 (0)