private static void checkMap(String fieldName, Object mapObj, Class<?> valueType) {
    checkArgument(mapObj instanceof Map, "'%s' needs to be a JSON object. Found: %s", fieldName, getClassName(mapObj));
    Map<?, ?> map = (Map<?, ?>)mapObj;
    map.forEach( (__, value) ->
      checkArgument(valueType.isInstance(value),
        "Expected %s as value type, found %s, type: %s",
        valueType.getName(), value, getClassName(value)));
  }
Converts {@link Configuration} objects to a collection easily serializable to Json
@param configuration the configuration to convert
@return the resulting collection
ambari-server/src/main/java/org/apache/ambari/server/topology/ConfigurableHelper.java