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

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

## 1. Role

### JKKStringUtil.nullToBlank()

The `nullToBlank` method is a shared defensive utility that nullifies null references by returning an empty string instead. In business terms, it serves as a null-safety guardrail that prevents NullPointerException (NPE) across the entire application — anywhere a string value may originate from user input, database reads, or inter-service communication, callers can safely invoke this method to guarantee a non-null `String` return value. It implements the **guard clause pattern**: if the input is null, it immediately substitutes a safe default (the empty string); otherwise it passes the original value through unchanged. This method is a **pure utility function** with no side effects, no I/O, and no state mutation — it is a shared building block called by many screens, CBS layers, and service components throughout the KOPT system to sanitize string parameters before further processing. The Javadoc (Japanese: "nullを空文字に置き換え" — "Replace null with empty string") explicitly states its contract: never return null.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["nullToBlank(params)"])
    COND([str is null?])
    RET_BLANK(["Return empty string"])
    RET_STR(["Return original str"])

    START --> COND
    COND -->|Yes| RET_BLANK
    COND -->|No| RET_STR
```

**Processing flow:**
1. **Entry** — The method receives a single `String` parameter `str` which may be `null` or a valid string reference.
2. **Null Check** — A null identity check (`str == null`) determines the execution path.
3. **Null branch** — If `str` is `null`, the method returns the empty string literal `""` (the `STRING_BLANK` constant value). This is the safety net that ensures callers never receive `null`.
4. **Non-null branch** — If `str` is not `null` (including empty strings `""`), the method returns the original reference unchanged, preserving any existing value including zero-length strings.

**No conditional branches on constants, no loops, no external method calls.** This is a pure guard-clause with two mutually exclusive paths.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `str` | `String` | The string value to be null-safened. This is the replacement target string (Japanese: 置き換え対象文字列). It may carry any business string data — customer names, service codes, addresses, or free-text fields — and may be `null` when originating from optional database columns, unset form fields, or incomplete data structures. |

**External state / instance fields read:** None. This method is static and stateless.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations**. It contains no database calls, no service component invocations, no CBS calls, and no entity/DB access. It is a pure in-memory null-check with immediate return.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| — | — | — | — | No CRUD operations. Pure utility method with no I/O. |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.

This method is a shared utility called from CBS (Controller/Service Component) classes. Both callers use it defensively on string fields before further processing.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKHakkoSODCC.callEKK0091A010_SC()` | `callEKK0091A010_SC` -> `JKKStringUtil.nullToBlank` | N/A (utility call, no terminal operation) |
| 2 | `JKKHakkoSODCC.checkTakinoRT()` | `checkTakinoRT` -> `JKKStringUtil.nullToBlank` | N/A (utility call, no terminal operation) |

**Notes:**
- `JKKHakkoSODCC.callEKK0091A010_SC()` — Likely the CBS entry for SC code `EKK0091A010`. The name suggests it handles a "hakko" (declaration/disclosure/registration) service order related screen operation.
- `JKKHakkoSODCC.checkTakinoRT()` — A routing check method for Takino Router service (`TAKINO_ROUTER`, constant `KKTK_SVC_CD_TAKINO_ROUTER = "C024"`). This caller likely validates router type strings.

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(str == null)` (L68)

> Null guard clause: if the incoming string reference is null, substitute the empty string.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return "";` // Replace null with empty string constant `STRING_BLANK` |

**Block 2** — ELSE `(str != null)` (L72)

> Non-null path: pass through the original string reference unchanged. This includes empty strings `""`, whitespace-only strings, and any populated string value.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return str;` // Return original string as-is |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `nullToBlank` | Method | Utility method name — replaces a `null` string reference with an empty string `""`, ensuring callers always receive a non-null `String` |
| `STRING_BLANK` | Constant | Empty string literal `""` used as the null-substitution default |
| NPE | Acronym | NullPointerException — the runtime exception this method prevents by never returning null |
| Guard Clause | Design Pattern | A control-flow pattern that early-returns when a precondition is not met; here, it returns early when the input is null |
| KOPT | Acronym | KOPT system — the enterprise telecom billing/order fulfillment platform in which this utility is used |
| CBS | Acronym | Component-Based Service — the service component layer in the KOPT architecture that contains business logic and screen handlers |
| CC | Acronym | Common Component — the shared utility layer (e.g., `JKKStringUtil`) providing reusable functions across all screens and services |
| 置き換え対象文字列 | Japanese Field | "Replacement target string" — the input string parameter that is the subject of the null-to-blank substitution |
