public static <T> T mergeValues(final T thisValue,
                                    final T otherValue,
                                    final T defaultValue,
                                    final boolean copyNulls,
                                    final boolean copyDefaults) {
        if (otherValue != null || copyNulls) {
            if (!Objects.equals(defaultValue, otherValue) || copyDefaults) {
                return otherValue;
            } else {
                return thisValue;
            }
        } else {
            return thisValue;
        }
    }
@return otherValue if it is non-null or copyNulls is true, else thisValue
stroom-util/src/main/java/stroom/util/config/PropertyUtil.java