Is it possible to use the Scala @BeanProperty annotation to create only the setter?
As far as I know @BeanProperty
synthesizes getter for val
fields and setter as well for var
. It is not possible to generate only setters, hence you must write the setter explicitly and do not use @BeanProperty
:
private var status = ""
def setStatus(s: String) {
this.status = s
}
Note the private
field modifier. Without it the status()
Scala-style getter will still be generated. For some reason it is generated as well with private var
, but it's private.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With