RFR: 8375588: Enhanced property metadata
John Hendrikx
jhendrikx at openjdk.org
Mon Jan 19 03:47:05 UTC 2026
On Sun, 21 Dec 2025 22:04:58 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
> > I do however have a bit of problem with `isAttached`; what does this have to do with properties in general? The description doesn't clarify what it means really, or what it even means outside the very specific case where HBox can "donate" properties to its children.
> > So to me, the attached part feels out of place for a low-level property API, unless there are compelling reasons and other use cases we'd envision outside of having CSS stylable child properties. If not, I don't see why we shouldn't make this a method on `Stylable` or something more Node/CSS specific like in this PR: #1714
>
> I think attached-ness is a fundamental aspect of properties, and making it visible in the type system is a logical choice. Compare this to WPF or Avalonia, where attached properties are also explicitly modelled. It's a piece of information that you can't reliably get from a property's metadata otherwise.
I never used either framework, so "attached" is completely meaningless to me, and the description didn't enlighten me. What would this mean when I have just a bunch of properties (like a model)? It seems to me it is giving some extra information related to some kind of parent/child relationship that's outside the definition of the properties themselves.
I'm only looking for a use case where this would be useful if I only have imported `javafx.base` to better understand it, and how it may benefit properties in general.
I did some checking, and this was suggested by AI:
- A `Task` is a simple model with a permanent property (name).
- A `Workflow` defines an attached property `activeInWorkflow`, which exists only while the task is in the workflow.
- `isAttached()` signals that this property is context-dependent, not intrinsic to `Task`.
- Listeners or code can use `isAttached()` to safely determine whether the property is meaningful.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/2015#issuecomment-3679626131
More information about the openjfx-dev
mailing list