@@ -121,7 +121,7 @@ public static <K,V> Map<K,V> mapOf(Object... keyValPair) {
121121 if (keyValPair .length % 2 != 0 )
122122 throw new IllegalArgumentException ("Keys and values must be in pairs" );
123123
124- Map <K ,V > map = new HashMap <K , V >(keyValPair .length / 2 );
124+ Map <K , V > map = new HashMap <>(keyValPair .length / 2 );
125125
126126 for (int i = 0 ; i < keyValPair .length ; i += 2 ){
127127 map .put ((K ) keyValPair [i ], (V ) keyValPair [i +1 ]);
@@ -140,29 +140,29 @@ public static void ensureCredentials(boolean valid, String messageKey) {
140140 throw new BadCredentialsException (LexUtils .getMessage (messageKey ));
141141 }
142142
143-
143+
144144 /**
145145 * Applies a JsonPatch to an object
146146 */
147- @ SuppressWarnings ("unchecked" )
147+ @ SuppressWarnings ("unchecked" )
148148 public static <T > T applyPatch (T originalObj , String patchString )
149- throws JsonProcessingException , IOException , JsonPatchException {
149+ throws IOException , JsonPatchException {
150150
151- // Parse the patch to JsonNode
152- JsonNode patchNode = objectMapper .readTree (patchString );
151+ // Parse the patch to JsonNode
152+ JsonNode patchNode = objectMapper .readTree (patchString );
153153
154- // Create the patch
155- JsonPatch patch = JsonPatch .fromJson (patchNode );
154+ // Create the patch
155+ JsonPatch patch = JsonPatch .fromJson (patchNode );
156156
157- // Convert the original object to JsonNode
158- JsonNode originalObjNode = objectMapper .valueToTree (originalObj );
157+ // Convert the original object to JsonNode
158+ JsonNode originalObjNode = objectMapper .valueToTree (originalObj );
159159
160- // Apply the patch
161- TreeNode patchedObjNode = patch .apply (originalObjNode );
160+ // Apply the patch
161+ TreeNode patchedObjNode = patch .apply (originalObjNode );
162162
163- // Convert the patched node to an updated obj
164- return objectMapper .treeToValue (patchedObjNode , (Class <T >) originalObj .getClass ());
165- }
163+ // Convert the patched node to an updated obj
164+ return objectMapper .treeToValue (patchedObjNode , (Class <T >) originalObj .getClass ());
165+ }
166166
167167
168168 /**
0 commit comments