<commit_before>package com.nhl.bootique.config.jackson;

import java.util.Iterator;
import java.util.function.BinaryOperator;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.nhl.bootique.log.BootLogger;

/**
 * A configuration merger that merges right-hand config argument into left-hand
 * argument. It will try to avoid copying objects as much as possible, so chunks
 * of left and right documents may end up merged in the resulting object. This
 * assumes an environment where the app cares about the merge result and throw
 * away both source and target after the merge.
 * 
 * @since 0.17
 */
public class InPlaceLeftHandMerger implements BinaryOperator<JsonNode> {

	private BootLogger bootLogger;

	public InPlaceLeftHandMerger(BootLogger bootLogger) {
		this.bootLogger = bootLogger;
	}

	@Override
	public JsonNode apply(JsonNode target, JsonNode source) {

		if (target == null) {
			return source;
		}<commit_msg>javadocs<commit_after>package com.nhl.bootique.config.jackson;

import java.util.Iterator;
import java.util.function.BinaryOperator;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.nhl.bootique.log.BootLogger;

/**
 * A configuration merger that merges right-hand config argument into left-hand
 * argument. It will try to avoid copying objects as much as possible, so chunks
 * of left and right documents may end up merged in the resulting object. This
 * assumes an app that cares about the merge result and throws away both source
 * and target after the merge.
 * 
 * @since 0.17
 */
public class InPlaceLeftHandMerger implements BinaryOperator<JsonNode> {

	private BootLogger bootLogger;

	public InPlaceLeftHandMerger(BootLogger bootLogger) {
		this.bootLogger = bootLogger;
	}

	@Override
	public JsonNode apply(JsonNode target, JsonNode source) {

		if (target == null) {
			return source;
		}
{'fraction_non_alphanumeric': 0.07547169811320754, 'fraction_numerical': 0.0030596634370219276, 'mean_word_length': 4.621776504297994, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1092579', 'n_tokens_mistral': 590, 'n_tokens_neox': 535, 'n_words': 194}