Reputation: 876
I've got a form on the page whose model is a CompoundPropertyModel
. I've got a bunch of children on this form.
My goal is to create a behaviour, which could determine what property expression the object the behavior is being attached to has (or if it has a non-property expression throw an exception).
I'm trying to do this in the bind
method so that in case it cannot be configured I would catch this early.
I got as far as extracting the model from the component. I was about to do an instanceof
when I realised that the model retrieved could not necessarily be an AbstractPropertyModel
as I've been expecting, since I am doing this using a CompountPropertyModel
.
So my question is: is there a reliable way I can find the property expression of a given model without knowing the model's type, but knowing it is a property model? (When I say 'a property model' I mean any model that is based on a property expression)
Upvotes: 0
Views: 603
Reputation: 5681
In Wicket 'knowing it is a property model' means it's an AbstractPropertyModel
- thus your instanceof
check should work fine.
If you rely on CompoundPropertyModel
implicitly initialising your model, then it will still be an AbstractPropertyModel
. Make sure that you have added the component to the parent providing the CompoundPropertyModel
before querying for the model though.
Upvotes: 2