The error is due to mismatch between java.lang.Long
and scala Long
.
Bean.AGE
is of type Bean.Attribute[java.lang.Long]
. Hence the scala compiler expects a java.lang.Long
as the other argument. But you are passing is 2L
which is scala.Long
and not java.lang.Long
. Hence it shows error.
Doing this will work as expected:
b.set(Bean.AGE,new java.lang.Long(23))
Thanks to @senia, the below is a better alternative:
bean.set[java.lang.Long](Bean.AGE, 23)
bean.set(Bean.AGE, 23:java.lang.Long)