test_class.declarator: testObject
test_class.modifier: private
test_class.original_string: private TestObject testObject;
test_class.type: TestObject
test_class.var_name: testObject
test_class.file: alien4cloud-common/src/test/java/alien4cloud/rest/utils/PatchUtilTest.java
test_class.identifier: PatchUtilTest
test_case.body: @Test
      public void check_a_patch_can_update_a_value() throws Exception {
          Map<String, String> patch = new HashMap<String, String>() {{
              put("a", "2");
          }};
  
          PatchUtil.setMap(testObject.getMap(), patch, true);
  
          assertThat(testObject.getMap()).containsEntry("a","2").containsEntry("b", "2");
      }
test_case.class_method_signature: PatchUtilTest.check_a_patch_can_update_a_value()
test_case.full_signature: @Test public void check_a_patch_can_update_a_value()
test_case.identifier: check_a_patch_can_update_a_value
test_case.invocations: put setMap getMap containsEntry containsEntry assertThat getMap
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void check_a_patch_can_update_a_value()
focal_class.declarator: NULL = "null"
focal_class.modifier: private static final
focal_class.original_string: private static final String NULL = "null";
focal_class.type: String
focal_class.var_name: NULL
focal_class.file: alien4cloud-common/src/main/java/alien4cloud/rest/utils/PatchUtil.java
focal_class.identifier: PatchUtil
focal_class.class_method_signature: PatchUtil.set(Object instance, String fieldName, Object value, boolean patch)
focal_class.full_signature: public static boolean set(Object instance, String fieldName, Object value, boolean patch)
focal_class.identifier: set
focal_class.modifiers: public static
focal_class.parameters: (Object instance, String fieldName, Object value, boolean patch)
focal_class.return: boolean
focal_class.signature: boolean set(Object instance, String fieldName, Object value, boolean patch)
focal_class.class_method_signature: PatchUtil.setMap(Map<A, B> instance, Map<A, B> newValues, boolean patch)
focal_class.full_signature: public static Map<A, B> setMap(Map<A, B> instance, Map<A, B> newValues, boolean patch)
focal_class.identifier: setMap
focal_class.modifiers: public static
focal_class.parameters: (Map<A, B> instance, Map<A, B> newValues, boolean patch)
focal_class.return: Map<A, B>
focal_class.signature: Map<A, B> setMap(Map<A, B> instance, Map<A, B> newValues, boolean patch)
focal_class.class_method_signature: PatchUtil.realValue(T value)
focal_class.full_signature: public static T realValue(T value)
focal_class.identifier: realValue
focal_class.modifiers: public static
focal_class.parameters: (T value)
focal_class.return: T
focal_class.signature: T realValue(T value)
focal_method.body: public static <A, B> Map<A, B> setMap(Map<A, B> instance, Map<A, B> newValues, boolean patch) {
          if (patch) {
              if (newValues == null || newValues.size() == 0) {
                  return instance;
              }
          }
  
          if (instance == null) {
              instance = new HashMap<>();
          }
  
          if (patch) {
              for (Map.Entry<A, B> entry : newValues.entrySet()) {
                  if (entry.getValue() == null || realValue(entry.getValue()) == null) {
                      // remove
                      instance.remove(entry.getKey());
                  } else {
                      // add or update
                      instance.put(entry.getKey(), entry.getValue());
                  }
              }
          } else {
              instance.clear();
              instance.putAll(safe(newValues));
          }
  
          return instance;
      }
focal_method.class_method_signature: PatchUtil.setMap(Map<A, B> instance, Map<A, B> newValues, boolean patch)
focal_method.full_signature: public static Map<A, B> setMap(Map<A, B> instance, Map<A, B> newValues, boolean patch)
focal_method.identifier: setMap
focal_method.invocations: size entrySet getValue realValue getValue remove getKey put getKey getValue clear putAll safe
focal_method.modifiers: public static
focal_method.parameters: (Map<A, B> instance, Map<A, B> newValues, boolean patch)
focal_method.return: Map<A, B>
focal_method.signature: Map<A, B> setMap(Map<A, B> instance, Map<A, B> newValues, boolean patch)