This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 257039 - Support private (non-JSON) state in @Model classes
Summary: Support private (non-JSON) state in @Model classes
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Html4j (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2015-12-07 22:26 UTC by Jaroslav Tulach
Modified: 2015-12-13 20:34 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Model.instance = true to keep private state (21.03 KB, patch)
2015-12-07 22:27 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2015-12-07 22:26:08 UTC
Sometimes, especially when dealing with other APIs, the classes generated by @Model annotation need to reference non-JSON-like data structures. Find a way to allow that.
Comment 1 Jaroslav Tulach 2015-12-07 22:27:07 UTC
Created attachment 157706 [details]
Model.instance = true to keep private state
Comment 2 Jaroslav Tulach 2015-12-07 22:28:31 UTC
Please review, thanks in advance for your comments.
Comment 3 maxnitribitt 2015-12-08 06:36:02 UTC
In your example in the diff, you don't show, how/if the value can be initialized/injected. Can you show if/how that's done?
Comment 4 Jaroslav Tulach 2015-12-08 11:42:30 UTC
It cannot be injected. The implementation class (the one annotated by @Model) needs to have accessible default constructor. That constructor is used to create the instance. Obviously such constructor does not have any parameters, so no initialization is possible. Later one can, however, call any @ModelOperation method and pass in additional configuration parameters.

I can put the previous paragraph into Javadoc, it may be a common question.
Comment 5 Jaroslav Tulach 2015-12-09 21:15:08 UTC
Explanation added: http://source.apidesign.org/hg/html~html4j/rev/558934b8b835
Comment 6 Jaroslav Tulach 2015-12-12 06:00:51 UTC
Unless there are objections, I integrate the change on Monday.
Comment 7 Jaroslav Tulach 2015-12-13 20:34:28 UTC
Merged as http://hg.netbeans.org/html4j/rev/02568f34628a