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

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

## 1. Role

### JKKStringUtil.isNullSpace()

The `isNullSpace` method is a **data validation utility** that determines whether a given string value is effectively "blank" from a business data integrity perspective. It performs two checks in sequence: first, whether the input reference is `null` (i.e., no object was provided at all), and second, whether the string, after removing all leading and trailing whitespace via `trim()`, resolves to an empty half-width space string (`""`). This method implements the **guard clause pattern**, allowing calling code to short-circuit processing when the input data is absent or meaningless.

The method is part of the shared common utilities (`eo.common.util`) package, meaning it is a **cross-cutting utility** callable from any layer — screens, services, batches, or CBS components — without introducing circular dependencies. It is the whitespace-aware counterpart to the simpler `isNullBlank` method, which checks for `null` or empty strings but does **not** trim leading/trailing spaces before comparison. This distinction is important: `isNullSpace` treats a string composed entirely of spaces (e.g., `"   "`) as blank, while `isNullBlank` would return `false` for such an input.

From a business standpoint, this method serves as the first line of defense in input validation pipelines, ensuring that downstream logic never attempts to process empty or whitespace-only data. Its role is purely observational — it performs no side effects, does not mutate state, and returns a boolean predicate for use in conditional branches.

**Design Pattern**: Guard clause / Predicate utility. The method implements a boolean predicate that evaluates a single input and returns `true` when the input should be rejected as invalid/blank data.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isNullSpace(str)"])
    COND1{"str is null OR str.trim is empty"}
    TRUE(["return true"])
    FALSE(["return false"])
    END_NODE(["Return"])

    START --> COND1
    COND1 -- true --> TRUE --> END_NODE
    COND1 -- false --> FALSE --> END_NODE
```

**Step-by-step processing:**

1. **Entry** — The method receives a `String str` parameter representing the business value to validate.
2. **Null check** — Evaluates whether `str` is `null`. If `str` is `null`, the condition evaluates to `true` immediately (short-circuit evaluation via `||`).
3. **Whitespace trim check** — If `str` is not `null`, the method calls `str.trim()` to strip all leading and trailing whitespace characters, then compares the result against an empty string literal `""` using `"\"\"".equals(str.trim())`. If the trimmed result equals `""`, the condition evaluates to `true`.
4. **Return true** — If either the null check or the empty-check after trim evaluates to `true`, the method returns `true`, signaling that the input is effectively blank.
5. **Return false** — If `str` is not `null` and contains at least one non-whitespace character, the method falls through to `return false`, signaling that the input is valid (non-blank).

**Conditional branches:**
- **Branch 1 (true path):** `str == null` — The caller passed `null` instead of a valid string.
- **Branch 2 (true path):** `"".equals(str.trim())` — The caller passed a string composed entirely of whitespace (e.g., `" "` or `"    "`), which after trimming becomes empty.
- **Branch 3 (false path):** `str` is non-null and contains at least one visible character — the input is valid data.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `str` | `String` | The input string value to validate for blankness. In business terms, this represents any text field where empty or whitespace-only data is considered invalid — such as service codes, customer names, reference IDs, or other alphanumeric identifiers. The method treats `null`, empty string `""`, and whitespace-only strings like `" "` as equivalent (all return `true`). |

No instance fields or external state are read by this method. It is a stateless, side-effect-free utility.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations**. It does not call any SC (Service Component) code, CBS (Common Business Service), DAO methods, or access any database tables or entities. The only method it invokes is `str.trim()`, which is a standard Java `String` library method that returns a copy of the string with leading and trailing whitespace removed.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| *(none)* | — | — | — | No data access operations — purely a predicate evaluation |

## 5. Dependency Trace

No callers were found in the codebase for this method. This indicates that either:
- The method is defined as a shared utility but not yet integrated into any calling code (newly added method), or
- Callers exist in areas not indexed in the current search scope.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| *(none found)* | — | — | — |

## 6. Per-Branch Detail Blocks

**Block 1** — `[IF]` condition check `(L53)`

> Evaluates whether the input string is null or contains only whitespace characters after trimming. This is a combined guard clause that catches both the absence of data (null) and the presence of meaningless data (whitespace-only).

| # | Type | Code |
|---|------|------|
| 1 | COND | `str == null` — Null check: verifies the reference is not pointing to any object |
| 2 | EXEC | `str.trim()` — Invokes Java `String.trim()` to strip leading/trailing whitespace characters |
| 3 | COND | `"".equals(str.trim())` — Compares trimmed result against empty string literal (uses literal-first style to avoid NPE) |
| 4 | OR | `||` — Short-circuit logical OR: if `str == null` is true, the second condition is skipped |

**Block 2** — `[IF-BRANCH: true]` `(L54-56)`

> When the condition is true (str is null or whitespace-only after trim), return true to signal that the input should be treated as blank/invalid.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` — Indicates the string is null or effectively blank (whitespace-only) |

**Block 3** — `[ELSE-implicit]` `(L57)`

> When the condition is false (str is non-null and contains at least one non-whitespace character), return false to signal that the input is valid non-blank data.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false;` — Indicates the string contains meaningful, non-blank content |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `isNullSpace` | Method | Validates whether a string is null or contains only half-width (ASCII) spaces after trimming. Part of a family of null/blank validation utilities. |
| `trim()` | Java method | Standard Java `String.trim()` — removes all leading and trailing whitespace characters (space, tab, newline, etc.) from a string. Returns a new string; does not modify the original. |
| `isNullBlank` | Method | A related utility in the same class that checks for `null` or empty string (`""`) but does NOT trim whitespace before comparison. `isNullSpace` is the stricter variant. |
| Half-width space | Term | A standard ASCII space character (U+0020). In Japanese computing contexts, "half-width" (半角) contrasts with "full-width" (全角) characters. This method specifically handles half-width spaces; full-width spaces would not be caught by `trim()` in standard Java. |
| Guard clause | Pattern | A programming pattern where early returns are used to handle edge cases (like null or blank input) before the main logic, simplifying code by avoiding deep nesting. |
| `eo.common.util` | Package | Enterprise Object common utilities — a shared, cross-cutting package containing utility classes used across all layers of the application (screens, services, batches, CBS). |
| `""` | Constant (inline) | Empty string literal — represents a string with zero characters. Used as the comparison target after `trim()` to detect whitespace-only strings. |
