# Business Logic — JKKStringUtil.nullBlankToSpace() [8 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.common.util.JKKStringUtil` |
| Layer | Utility (Common Component) |
| Module | `util` (Package: `eo.common.util`) |

## 1. Role

### JKKStringUtil.nullBlankToSpace()

This method is a string normalization utility used throughout the application to ensure that no `null` or empty-string values are passed downstream to business logic or presentation layers. It implements a **defensive placeholder pattern**: when the input string is `null` or blank (i.e., zero-length `""`), it returns a single space character `" "` as a safe default; otherwise it returns the original string unchanged. This avoids `NullPointerException` and prevents blank values from breaking UI rendering (e.g., empty table cells, broken CSS layouts) or corrupting data-bound fields. As a shared static utility in the common component layer (`eo.common.util`), it is designed to be called from any tier — screens, services, CBS components, or data mappers — wherever a string value must never be `null` or empty at the point of use. The method performs no conditional branching by service type or domain; it applies a single, uniform rule to all inputs, making it a universal guard against null/blank propagation.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["nullBlankToSpace params"])
    CHECK{"isNullBlank str\
is True or False"}
    REPLACE["Return space character"]
    RETURN_STR["Return str as-is"]
    END(["Return / Next"])

    START --> CHECK
    CHECK -->|True| REPLACE
    REPLACE --> END
    CHECK -->|False| RETURN_STR
    RETURN_STR --> END
```

**Processing Summary:**

1. **Entry:** Method receives a `String str` parameter from the caller.
2. **Check:** Delegates to `JKKStringUtil.isNullBlank(str)` to determine whether the input is `null` or an empty string (`""`).
3. **Branch (True):** If `isNullBlank` returns `true` — the input is `null` or `""` — the method returns a single space character `" "` as the safe replacement value.
4. **Branch (False):** If `isNullBlank` returns `false` — the input is a non-empty string with content — the method returns the original `str` unchanged.
5. **Return/Next:** The result (`" "` or `str`) is returned to the caller.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `str` | `String` | The input string value that needs null/blank safeguarding. This can be any textual data in the application — field values from forms, database fields, API payloads, or intermediate processing results. It represents business data that must never be `null` or empty when consumed downstream (e.g., by UI rendering, data binding, or string concatenation). |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKStringUtil.isNullBlank` | JKKString | - | Calls `isNullBlank` in `JKKStringUtil` to check if the input string is `null` or empty |

This method does **not** perform any Create, Read, Update, or Delete operations on databases or external services. It is a pure function that transforms a single input string and returns the result. The only internal call is to `isNullBlank()`, a helper method within the same utility class.

## 5. Dependency Trace

This method has **no callers** outside of its own definition file. It is a static utility method used internally by other methods within the codebase (referenced by callers via `JKKStringUtil.nullBlankToSpace(...)`) but does not appear as a named call site in any other source file at the method-invocation level. This is typical for shared utility methods that are referenced indirectly or whose call sites are not explicitly searched as full signatures.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | - | - | No external callers found at method level |

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(isNullBlank(str))` (L98)

> Check whether the input string is null or empty. If so, substitute with a space character.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isNullBlank(str)` — Delegated call to the utility's null/blank check helper [-> JKKStringUtil.isNullBlank] |
| 2 | SET | `return " "` — Returns a single space character as the safe placeholder |

**Block 2** — ELSE `(L102)`

> The input string is neither null nor empty. Return it unchanged.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return str` — Returns the original input string as-is |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `isNullBlank` | Method | Null/blank check utility — returns `true` if a string is `null` or an empty string `""`, `false` otherwise |
| `null` | Technical term | Java language concept representing the absence of any object reference |
| Blank | Business term | An empty string (`""`) with zero length but non-null — a value that exists but contains no characters |
| Space character `" "` | Constant | A single space (`' '`) used as a safe default placeholder to prevent rendering or data-binding issues |
| `JKKStringUtil` | Class | Common string utility class providing static helper methods for null/blank checking, string manipulation, and text normalization |
| Utility method | Design pattern | A stateless, static helper method in a common library that provides reusable functionality across all application layers |
