Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Options should be immutable & use builder pattern. #148

Open
Labels
enhancementNew feature or request
@michael-schnell

Description

@michael-schnell

It's a good style in Java to keep classes immutable if possible. This prevents accidential changes and makes them thread safe by design.

The "Options" classes like "DeleteStreamOptions" are currently mutable, which is kind of unexpected. It looks like a builder, but mutates the content of the instance:

DeleteStreamOptions opts = DeleteStreamOptions.get(); // Defaultopts.softDelete(); // Now softopts.hardDelete(); // Now hard

I would suggest to create a real builder that returns an immutable instance.

Here is a short example of how the builder pattern would look like:
https://github.com/EventStore/EventStoreDB-Client-Java/compare/trunk...michael-schnell:issue-148?diff=split

If you think this is a good idea, I can create a pull request to discuss this further in detail in the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp