-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Easy way to add Methods to Java classes #81
Comments
From JasonBog...@gmail.com on November 28, 2012 14:47:30 |
From JasonBog...@gmail.com on November 28, 2012 16:54:50 Just let me know asap if this is something that can be done quickly and easily so we can figure out how to proceed with our project. Thanks! |
From joelittl...@gmail.com on November 28, 2012 19:57:01 To be frank, this is a very specific set of requirements (to accommodate a fairly specific style of development) that I don't see being applicable to many, if any, other users. For this reason, I think it would be best for you to clone the repo and add the features you need. I'm not sure that I understand why you're so keen to enforce this pattern by creating abstract classes and adding TODOs. Could you not simply take the current output and extend the types (with a subclass) where you need to? The generated types aren't marked final. I'm happy to give you some pointers if you're interested in implementing this yourself (it should be trivial to build and deploy your own custom jar). As it stands, I don't think there's much value in adding this into the core. |
From JasonBog...@gmail.com on November 29, 2012 20:52:12 I could just create individual subclasses for them, but using an IDE like Eclipse creates ambiguity as to which class I'm referring to. For example, if I want an address class, I could generate Address.java, but then I need to subclass it as perhaps AddressModel.java or AddressWrapper.java, etc to add an "isValidAddress()" method. It's a decent pattern, but confusing to a new user who is not familiar with the code. Generating them as abstract as a different name and then automatically subclassing them with the desired name reduces ambiguity. This tool is kind of useless unless it explicitly facilitates subclasses. |
From joelittl...@gmail.com on November 29, 2012 23:18:08 There's no need to give up on your feature though. Feel free to create a clone and have a go at implementing what you need: https://code.google.com/p/jsonschema2pojo/source/checkout If enough people are interested using this kind of feature, then I'll definitely think again about whether this can be added to the core. Again, thanks for your comments. I find it very useful to understand how people use the tool, even where their requirements currently aren't within the scope or goals of the project. |
I know that this issue is closed, but I wanted to add 2 things : So I just wanted to add that he was not alone to want this kind of functionalities. I'm still learning how to use your code and customize the generation, so maybe I miss some features. Thanks again ! |
Original author: JasonBog...@gmail.com (November 28, 2012 14:46:24)
Using auto-generated code is great, but it's hard to add other methods to the generated classes when they will be overwritten on the next Maven build.
Here's what I suggest:
Examples attached
Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=81
The text was updated successfully, but these errors were encountered: