Basically, I have a class, that has several getters that return different Seqs. But I need to use those collections in java code. I implemented alternate getters, that return java collections explicitly, but I want to do that in a more implicit way. Something like that:
class X {
@AsJava //annotation that generates method someSeqJava: java.util.List[Int]
def someSeq: Seq[Int] = Seq(1,2,3,4)
}
Or any other way. I do not want to write all those convertions myself all the time.
Thanks.
This is similar to @BeanProperty annotation and it should be relatively easy to create a compiler plugin that does the job. In fact, from your needs, it seems you could hook the plugin after the
typerphase (so that symbols and types are all available).EDIT:
I’d suggest you to take a look at the following discussions, they might help:
Here is a short guide from the official scala website