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 generation of external Meta-Bean #178

Open
andreas-schilling opened this issue Oct 18, 2017 · 5 comments
Open

Allow generation of external Meta-Bean #178

andreas-schilling opened this issue Oct 18, 2017 · 5 comments

Comments

@andreas-schilling
Copy link
Contributor

I wonder if it would be a good idea to optionally allow the generation of external Meta-Beans (just the Meta-Bean in its own class)?
This would allow for not having to check in generated code into version control, keep the bean classes more compact and closer to a plain POJO (except the annotations of course and yes, of course they are also sort of plain with all the generated code...)
On the flipside one would always have to run the generation step upon a fresh checkout, but I don't think this is much of a drawback (some people might also argue it's the cleaner way).

@hackmann
Copy link
Contributor

Our internal guides say that autogenerated code should not be committed to version control. So I always find it strange when all the autogenerated JodaBeans are committed in full. When I find some time I'll take a look at the maven plugin and see if it's possible to change it to generate the code under target instead of adding to the original file. Similar to how other code generator tools work

@andreas-schilling
Copy link
Contributor Author

I think it's quite clear that we can implement this sort of thing in the respective generators but I was more trying to understand first whether there are technical reasons for the status quo :-)
Thinking some steps ahead: If the generator would allow to plug in extensions that write to different files then anyone could also implement very specific and custom tailored functionality that is based on the metamodel.
Of course all of this would also work with stuff going to a single file (the original one), but then code length would get out of hand even more.
TL;DR: I think this issue needs the Discussion tag :-)

@jodastephen
Copy link
Member

Joda-Beans was intended for a use case where code checked out of a source repo should compile immediately (without any need to run a tool like an annotation processor or maven).

The code isn't that well structured to break out a meta-model for pluggable generators, however that would very much be a good direction to go.

As for the amount of code, the light and minimal bean styles generate less code and may be of interest. Particularly as of the latest release.

@andreas-schilling
Copy link
Contributor Author

Thanks for jumping in!
So there are no hard technical reasons that would not allow the Meta-Beans to be in their own files and/or subpackages, right? Might be an interesting extension then maybe to optionally allow generating them like that.

@jodastephen
Copy link
Member

MetaBean is a normal Java interface and can be implemented as such - any way you want.

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

No branches or pull requests

3 participants