Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looking for a way to change the Modifiable visibility #1111

Open
ChrisTrenkamp opened this issue Oct 24, 2019 · 0 comments
Open

Looking for a way to change the Modifiable visibility #1111

ChrisTrenkamp opened this issue Oct 24, 2019 · 0 comments

Comments

@ChrisTrenkamp
Copy link

I'm using a custom Immutable style:

@Value.Style(
    typeImmutable = "*Impl",
    typeModifiable = "*Modifiable",
    visibility = Value.Style.ImplementationVisibility.PACKAGE,
    overshadowImplementation = true,
    implementationNestedInBuilder = true)
@Target(value = {ElementType.TYPE})
public @interface CustomImmutableStyle {}

I prefer this style because it keeps the builder public, while hiding the *Impl class from the API. This keeps things clean and simple.

However, I'm in a situation where using a *Modifiable makes things easier (I need to access some fields before it's done building). The visibility style is putting the *Modifiable class at the package level, so consumers of the API don't have access to it. My only choice is to make the visibility public.

Is there a way to make the *Modifiable class public, while keeping the *Impl class at the package level?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant