0

I have event in Java and I need help how to get value of field (for example of columnFootersVisible).

More info - Event is Vaadin Property.ValueChangeEvent

  • Event->
    • source->
      • columnFootersVisible - false

Here screenshot of event: enter image description here

I know I can get source object, but is it possible to get all event data visible in debbuger?

default locale
  • 13,035
  • 13
  • 56
  • 62

1 Answers1

0

IDE have shown you the values of protected (source, yellow mark) and private (columnFootersVisible, red mark) fields of objects (event and table). While it's possible to access private fields in Java through reflection, the normal way is to use public API.

Both event's source and Table's columnFootersVisible fields have proper public accessors: getSource and isFooterVisible, correspondingly. So, you can use these methods:

if(event.getSource() instanceOf Table) {
    Table table = (Table) event.getSource();
    boolean isFooterVisible = table.isFooterVisible();
}

If, for some obscure reason, you still want to access private fields directly, then you might want to take a look on this question:

Is it possible in Java to access private fields via reflection

Community
  • 1
  • 1
default locale
  • 13,035
  • 13
  • 56
  • 62