Closed ruckustboom closed 8 years ago
I think all the use cases that would have to be covered would be:
Original Type | Property Type | Mutator Type |
---|---|---|
Int | SimpleIntegerProperty | Int |
Int? | SimpleObjectProperty<Int> | Int? |
Long | SimpleLongProperty | Long |
Long? | SimpleObjectProperty<Long> | Long? |
Boolean | SimpleBooleanProperty | Boolean |
Boolean? | SimpleObjectProperty<Boolean> | Boolean? |
Float | SimpleFloatrProperty | Float |
Float? | SimpleObjectProperty<Float> | Float? |
Double | SimpleDoubleProperty | Double |
Double? | SimpleObjectProperty<Double> | Double? |
String | SimpleStringProperty | String? |
String? | SimpleStringProperty | String? |
T | SimpleObjectProperty<T> | T? |
T? | SimpleObjectProperty<T> | T? |
It would also be nice if, when converting a constructor parameter, you have the option of keeping the passed in value as a default.
class Person(val name: String)
becomes
class Person(name: String) {
val nameProperty = SimpleStringProperty(name)
var name: String? by nameProperty
}
Absolutely, I will add this as a configuration option for the plugin :)
Implemented, will roll it out today, but would prefer it you have a few minutes to go over it first @t-boom
Would it be possible to add an option to have the "Convert to TornadoFX Property" command use the new property syntax? e.g.
I'm not sure how difficult it would be as there would have to be checks for the primitive properties and Strings to create
SimplePrimitiveProperty
s, while defaulting toSimpleObjectProperty<Type>
for the rest, but I tend to prefer the new syntax myself (for the null safety and extra features added to the specific property classes).