Skip to content
This repository was archived by the owner on Apr 30, 2026. It is now read-only.
This repository was archived by the owner on Apr 30, 2026. It is now read-only.

refactor: isolate database logic into Repository layer #27

@RuskLabo

Description

@RuskLabo

概要

現在、AttributeManager や LevelManager などのマネージャークラスに SQL クエリが直接記述されています(密結合)。これを Repository
パターンを用いて分離し、ビジネスロジックとデータ永続化処理の責務を明確に切り分けます。

期待される変更

  1. Repositoryクラスの作成: com.lunar_prototype.deepwither.repository パッケージを新設し、各マネージャーに対応するリポジトリ(例: PlayerAttributeRepository)を作成する。
  2. 抽象化APIの活用: 新しく実装した IDatabaseManager (DW.db()) の execute や querySingle を使用し、ボイラープレートコード(try-catch, Connection管理)を排除する。
  3. Managerの軽量化: マネージャーはリポジトリを呼び出すだけにし、データの保存方法(SQLite/MySQL)を意識しないようにする。

実装イメージ (LevelManager)

1 // Manager側
2 public void save(UUID uuid) {
3     PlayerLevelData data = dataMap.get(uuid);
4     repository.save(uuid, data); // 1行で完結
5 }

やることリスト

  • AttributeManager -> AttributeRepository
  • LevelManager -> LevelRepository
  • SkilltreeManager -> SkilltreeRepository
  • ClanManager -> ClanRepository

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Task.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions