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 250611 - Support builder style properties
Summary: Support builder style properties
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Html4j (show other bugs)
Version: 8.1
Hardware: PC Other
: P3 normal with 1 vote (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2015-02-22 12:25 UTC by Jaroslav Tulach
Modified: 2015-11-05 22:39 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Patch with implementation (16.10 KB, patch)
2015-10-29 20:32 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-02-22 12:25:20 UTC
In certain situations it would be valuable to chain calls to setters in class generated by @Model annotation in builder-like style:

@Model(className="C", properties={
  @Property(name="a", type=String.class),
  @Property(name="b", type=String.class),
  @Property(name="c", type=String.class),
  @Property(name="d", type=String.class),
  @Property(name="e", type=String.class),
  @Property(name="f", type=String.class),
})

C c = new C().a("a").b("b").c("c").d("d").e("e").f("finish");

this could probably be done by enhancing the Model class with attribute

boolean builder() default false;

and honoring it by generating appropriate "setters" returning this.
Comment 1 Jaroslav Tulach 2015-10-29 20:32:46 UTC
Created attachment 157055 [details]
Patch with implementation
Comment 2 Jaroslav Tulach 2015-10-29 20:33:39 UTC
I'd like to make this available for version 1.3 of HTML/Java API.
Comment 3 Jaroslav Tulach 2015-11-05 21:56:52 UTC
No comments, let's integrate something like the proposed change.
Comment 4 Jaroslav Tulach 2015-11-05 22:39:55 UTC
http://hg.netbeans.org/html4j/rev/10427ce1c0ee