On Mon, 22 Dec 2025 23:05:04 GMT, Andy Goryachev <[email protected]> wrote:

>> Sure, but that wasn't my point. I don't see any indication that the method 
>> currently called `buildParagraph` builds a paragraph. What it does is 
>> returns a paragraph builder. Great, but in that case, the method is misnamed.
>> 
>> So, either I'm missing something (possible, but I've looked at it pretty 
>> closely by now) or the name of this method should be changed (you'll also 
>> need to fix the first sentence of the docs).
>> 
>> What I see is this:
>> 
>> `RichTextModel:: buildParagraph` returns a builder. The only caller of that 
>> method is getParagraph, which then calls build and it is _that_ call to 
>> build, not the call to this method that builds the paragraph:
>> 
>> 
>>         RichParagraph.Builder b = buildParagraph(index);     <-- this 
>> returns a builder
>>         return b.build();        <-- this is the build
>>     }
>
> I think I know what the problem is.  
> 
> The method is still "building" the paragraph, in a sense that it puts 
> together parts of the paragraph into a container (which is called "builder") 
> and perhaps this is confusing.
> 
> How about renaming this method to something like `prepareParagraph`() or 
> `constructParagraph`?

OK, I see the distinction you are trying to make. This method creates a 
builder, but then populates it with most of what is needed to setup prior to 
building it.

In that case, my suggestion of `paragraphBuilder` wouldn't be good, because it 
does more than that. `prepareParagraph` seems reasonable to me 
(`constructParagraph` has a similar problem as `buildParagraph` in that it 
doesn't construct a Paragraph object).

So I'm OK with `prepareParagraph`. A custom models would override and use it to 
prepare the paragraph differently. I think this works.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1966#discussion_r2641498744

Reply via email to