This page is no longer maintained — Please continue to the home page at

@BeanProperty on an Option field doesn't play well with java

No replies
Brett Knights
Joined: 2009-01-18,
User offline. Last seen 42 years 45 weeks ago.

I was going to write this up as a Trac enhancement request but I thought
I'd post here for comments first:

if I annotate an Option field

var n:Option[String] = None

I get getter/setter pairs with java signatures of
public void setN(scala.Option n);
public scala.Option getN();

which isn't much good if I'm trying to have a class that plays well with

is it good (or good enough) design to have public fields which need
getter/setter methods be Options?

Is there any barrier to having @BeanProperty be Option aware and just
@BeanProperty var n:Option[String] = None

def setN(String n):Unit = { n_(Some(n))}
def getN:String = {n.getOrElse(null)}

Thanks for your comments

Brett Knights

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland