EDIT . I know about the support features and that they will cover most use cases. I am not looking for work, I specifically look to see if there is a way to name the field of support.
You can easily rename getter and setter properties like this:
@get:JvmName("getFancy")
@set:JvmName("setFancy")
var fancyProperty = ...
But I canβt figure out how to change the name of the support field, even using the target @field.
@field:JvmName("fancy")
var fancyProperty = ...
The above errors:
This annotation does not apply to the target "member property with support field" and uses the target site "@field"
Ultimately, what I'm going to do is interact with JavaFX. When defining a JavaFX property, you usually follow the following standard (with some additional code to make it lazy):
private ObjectProperty<Color> color = new SimpleObjectProperty<>(this, "color", DEFAULT_COLOR);
public ObjectProperty<Color> colorProperty() {
return color;
}
public Color getColor() {
return colorProperty.get();
}
public void setColor(Color color) {
colorProperty().set(color);
}
- ( @field ):
@field:JvmName("color")
@get:JvmName("colorProperty")
val colorProperty: ObjectProperty<Color> =
SimpleObjectProperty(this, "color", DEFAULT_COLOR)
var color
get() = colorProperty.get()
set(value) = colorProperty.set(value)
FXML ( ), Java - Kotlin.
backing, , color ObjectProperty<Color>, getter setter color color.
, JavaFX , - @get:JvmName("colorProperty"), , .