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

Add option for generating toString() methods basing on fields #34

Open
alexander-yevsyukov opened this issue May 28, 2022 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@alexander-yevsyukov
Copy link
Collaborator

Have a look at the Twitter thread which hinted me on this feature. The thread shows the way TypeScript defines new types basing on values of other types used in a string form.

Currently we have an ability in Java to add a mix-in interface which would allow to have a custom toString(), but it's too much work. A more simple approach would be to have a type option, which would be used by a Model Compiler for a corresponding language. Something like this:

message Length {
   option (string_form) = "${value}${units}";
   int value = 1 [(required) = true];
   LengthUnit units = 2 [(required) = true];
}
@alexander-yevsyukov alexander-yevsyukov added the enhancement New feature or request label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant