# Business Logic — FUW00156SF03DBean.typeModelData() [33 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW00156SF.FUW00156SF03DBean` |
| Layer | View / Data Bean (Web Layer) |
| Module | `FUW00156SF` (Package: `eo.web.webview.FUW00156SF`) |

## 1. Role

### FUW00156SF03DBean.typeModelData()

This method serves as the **data type resolver** for customer-directed mail (顧客向けメール) recipient-related form fields within the FUW00156SF web module. It implements the **routing/dispatch pattern** — acting as a centralized type metadata provider that tells the X33V data binding framework which Java `Class` type each field expects, enabling automatic form validation and type-safe data binding.

The method handles two specific data types: the **Recipient Email Address** field (送信先メールアドレス, item ID: `mlad`) and the **Email Address Settings Field Code** field (メールアドレス設定フィールドコード, item ID: `mlad_set_field_cd`). For each, it returns `String.class` regardless of whether the subkey is "value" (the field's data value) or "state" (the field's UI state — e.g., enabled, disabled, read-only).

This method's role in the larger system is a **shared utility** called by the data type binding infrastructure whenever the framework needs to determine the expected type of a field. It is instantiated and managed by `FUW00156SFBean` for the "Customer-Directed Mail Recipient List" (お客様向けメール送信先リスト) repeating data item, making it a standard callback in the framework's type resolution lifecycle. The method contains no conditional branches beyond simple equality checks and no external service calls — it is a pure metadata lookup.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData(key, subkey)"])
    
    COND_NULL{"key or subkey is null?"}
    
    SEP_FIND["Find separator '/' in key"]
    
    COND_MLAD{"key ==
'送信先メールアドレス'?
(Recipient Email Address)"}
    COND_MLAD_STATE{"subkey == 'value' or 'state'?
(case-insensitive)"}
    MLAD_RETURN["Return String.class"]
    
    COND_MLA{"key == 'メールアドレス設定フィールドコード'?
(Email Address Settings Field Code)"}
    COND_MLA_STATE{"subkey == 'value' or 'state'?
(case-insensitive)"}
    MLA_RETURN["Return String.class"]
    
    DEFAULT_RETURN["Return null
(no matching key found)"]
    
    START --> COND_NULL
    COND_NULL -->|Yes| DEFAULT_RETURN
    COND_NULL -->|No| SEP_FIND
    SEP_FIND --> COND_MLAD
    COND_MLAD -->|Yes| COND_MLAD_STATE
    COND_MLAD_STATE -->|Yes| MLAD_RETURN
    COND_MLAD_STATE -->|No| DEFAULT_RETURN
    COND_MLAD -->|No| COND_MLA
    COND_MLA -->|Yes| COND_MLA_STATE
    COND_MLA_STATE -->|Yes| MLA_RETURN
    COND_MLA_STATE -->|No| DEFAULT_RETURN
    COND_MLA -->|No| DEFAULT_RETURN
    MLAD_RETURN --> END1(["Return"])
    MLA_RETURN --> END1
    DEFAULT_RETURN --> END2(["Return"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The field name (項目名) that identifies which form field's type is being queried. For this bean, valid values are `"送信先メールアドレス"` (Recipient Email Address — the email address of a mail recipient) or `"メールアドレス設定フィールドコード"` (Email Address Settings Field Code — the field code identifying how email address settings are configured). |
| 2 | `subkey` | `String` | The sub-field identifier within the named field. Valid values are `"value"` (the actual data content of the field) or `"state"` (the UI state of the field, such as enabled/disabled/readonly — スタイタス refers to the display state). The comparison is case-insensitive. |

**External state:** This method reads no instance fields or external state. It is stateless — the return value depends entirely on the two input parameters.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and calls **no external services**. It is a pure metadata lookup — a read-only type resolution that does not interact with any database, entity, or service component.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| (none) | — | — | — | This method is a pure type resolver with no data access or service calls. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean: FUW00156SFBean (module dispatcher) | `FUW00156SFBean.typeModelData(gamenId, key, subkey)` → `FUW00156SF03DBean.typeModelData(key, subkey)` | No terminal — pure type lookup |

**Details:** The `FUW00156SFBean` class (the parent module dispatcher) instantiates `FUW00156SF03DBean` as a nested bean for the "Customer-Directed Mail Recipient List" (お客様向けメール送信先リスト) repeating data item. When the X33V data binding framework needs to resolve the type of a field within this nested bean, it calls `typeModelData` on the bean instance. The parent bean's `typeModelData` method delegates directly to the child bean's implementation via `return typeModelData(key, subkey);`.

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null check) `(key == null || subkey == null)` (L242)

> If either the field name or subkey is null, return null immediately. This is a guard clause to prevent NullPointerException during subsequent string operations.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // 項目名とサブキーがnullの場合、nullを返す (Return null when key or subkey is null) |

**Block 2** — EXEC (separator extraction) (L245)

> Find the position of the "/" separator in the key. Although not used directly in this method's logic (no key routing via separator path occurs in this bean), the value is computed and stored.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // 項目ごとに処理を入れる (Insert processing per field) |

**Block 3** — IF-ELSE-IF (field routing) `(key.equals("送信先メールアドレス"))` (L248)

> Route processing based on field name. First branch: the "Recipient Email Address" field (項目ID: `mlad` — Mail Recipient Address).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key.equals("送信先メールアドレス"))` // データタイプがStringの項目"送信先メールアドレス" (Field of data type String: "Recipient Email Address") |

**Block 3.1** — IF-ELSE-IF (subkey check) `(subkey.equalsIgnoreCase("value"))` (L249)

> Check if the subkey is "value" (the field's data content).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` |
| 2 | RETURN | `return String.class;` // メールアドレスの値型を返す (Return String class for email address value) |

**Block 3.2** — ELSE-IF (subkey check) `(subkey.equalsIgnoreCase("state"))` (L253)

> Check if the subkey is "state" (the field's UI state — スタイタス (state) refers to the display/editing state of the field. When the subkey is "state", return String.class as well.

| # | Type | Code |
|---|------|------|
| 1 | ELSE_IF | `else if(subkey.equalsIgnoreCase("state"))` // subkeyが"state"の場合、スタイタスを返す。 (If subkey is "state", return the state) |
| 2 | RETURN | `return String.class;` // stateの場合もString.classを返す (Also return String.class for state) |

**Block 4** — ELSE-IF (field routing) `(key.equals("メールアドレス設定フィールドコード"))` (L259)

> Second branch: the "Email Address Settings Field Code" field (項目ID: `mlad_set_field_cd` — Mail Address Settings Field Code). This field code determines how email address settings are configured in the UI.

| # | Type | Code |
|---|------|------|
| 1 | ELSE_IF | `else if(key.equals("メールアドレス設定フィールドコード"))` // データタイプがStringの項目"メールアドレス設定フィールドコード" (Field of data type String: "Email Address Settings Field Code") |

**Block 4.1** — IF-ELSE-IF (subkey check) `(subkey.equalsIgnoreCase("value"))` (L260)

> Check if the subkey is "value" for the field code field.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` |
| 2 | RETURN | `return String.class;` // フィールドコードの値型を返す (Return String class for field code value) |

**Block 4.2** — ELSE-IF (subkey check) `(subkey.equalsIgnoreCase("state"))` (L264)

> Check if the subkey is "state" for the field code field. Return String.class for the field code's state as well.

| # | Type | Code |
|---|------|------|
| 1 | ELSE_IF | `else if(subkey.equalsIgnoreCase("state"))` // subkeyが"state"の場合、スタイタスを返す。 (If subkey is "state", return the state) |
| 2 | RETURN | `return String.class;` // stateの場合もString.classを返す (Also return String.class for state) |

**Block 5** — RETURN (fallback) (L271)

> No matching field was found. Return null to signal that the key is not recognized by this bean's type resolver.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // 条件に一致するプロパティが存在しない場合は、nullを返す。 (If no property matching the condition exists, return null) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `送信先メールアドレス` | Field | Recipient Email Address — the email address of a customer-directed mail recipient. Item ID: `mlad` |
| `メールアドレス設定フィールドコード` | Field | Email Address Settings Field Code — the field code that identifies how email address settings are configured in the UI. Item ID: `mlad_set_field_cd` |
| `key` | Parameter | Field name — the business identifier of the form field whose type is being queried |
| `subkey` | Parameter | Sub-field identifier — distinguishes between the field's data value ("value") and its UI state ("state") |
| `value` | Sub-key | The actual data content of a form field |
| `state` | Sub-key | The UI state of a form field (e.g., enabled, disabled, read-only) — referred to as スタイタス (state) in Japanese comments |
| FUW00156SF | Module | Customer-Directed Mail Management — a web module handling customer-facing email transmission features |
| X33V | Framework | The enterprise Java web framework providing data binding, validation, and view-type bean infrastructure |
| `String.class` | Return type | The Java class representing string data — this method always returns String.class for known fields, indicating all mail recipient fields are string-typed |
