XtremeBaumer
XtremeBaumer

Reputation: 6435

JFace databinding bind field of parent class

I have a little problem with my databinding on a parent class.

This is the structure:

class Instrument{
    //some more fields
    private Entity e;

}

class Equity extends Instrument{
    //some fields (not someField)
}

class Entity{
    private String someField;
}

I want to call PropertyDescriptor descriptor = PropertyUtils.getPropertyDescriptor(model.getValue(), propertyName);, where model.getValue() returns an object of type Equity and propertyName specifies the field name (Instrument.e).

I tried all kind of various approaches like:

It fails for every approach but the last with

java.lang.NoSuchMethodException: Unknown property 'someField' on class 'class Equity'

Even though it doesn't throw that exception, it does not set any value even if there is one.

So my question is, how can I add databinding to my control on Instrument.e.someField from Equity?

Upvotes: 1

Views: 57

Answers (1)

XtremeBaumer
XtremeBaumer

Reputation: 6435

Turns out I was just dumb as hell. I forgot to create getter and setter for private Entity e; in Instrument class. Once I added those, it worked just fine with e.someField

Upvotes: 1

Related Questions