Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between SimpleStringProperty and StringProperty

I am working with JavaFx TableView and found there are some classes to use a TableView for example SimpleStringProperty, StringProperty, SimpleBooleanProperty and BooleanProperty, etc. Now I am wondering about which one to use for TableView either SimpleStringProperty or only StringProperty and what are the difference between them.

like image 431
Biswadip Dey Avatar asked Jan 21 '15 06:01

Biswadip Dey


1 Answers

StringProperty is the abstract base class for observable string properties, SimpleStringProperty is a concrete implementation.

The rule is:

  1. Show StringProperty in your API
  2. Use SimpleStringProperty as the concrete implementation in your code

You sometimes see JavaFX code itself createing anonymous inner classes from StringPropertyBase and the reason for this is that it is a bit more effecient memorywise but nothing you normally have to bother yourself.

like image 84
tomsontom Avatar answered Oct 20 '22 01:10

tomsontom