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

Allow eliminating and overriding companion .apply method #77

Open
missingfaktor opened this issue Mar 14, 2017 · 1 comment
Open

Allow eliminating and overriding companion .apply method #77

missingfaktor opened this issue Mar 14, 2017 · 1 comment
Labels
uncategorized Used for Waffle integration

Comments

@missingfaktor
Copy link

IIUC, presently, Contraband generates the companion .apply method for all the data types. It may be useful to make it optional, and override it when needed. This is useful when you want to hide the actual constructor, and provide a smart constructor.

@dwijnand
Copy link
Member

As of 0b05c3f the constructors are already hidden, and the generated apply methods are the smart constructors.

Part of Contraband's ideology and encoding relies on owning and controlling the generated apply methods, so I fear this feature might be a bit "against the grain".

To be able to provide more useful, alternative apply methods to the ones provided to you by Contraband (and I've shared this same need) you need to either reach for extension methods or encode them as Scala embedded in JSON strings, with the necessary escaping (or double escaping) of course. I'm not sure if the Contraband Schema Language (CSL) provides an equivalent.

@eed3si9n eed3si9n added the uncategorized Used for Waffle integration label Sep 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
uncategorized Used for Waffle integration
Projects
None yet
Development

No branches or pull requests

3 participants