A simple Scala JavaBean example
Just a quick note today that if you want to create a JavaBean class in Scala (a Scala JavaBean), you can use the @BeanProperty annotation as shown here:
class Person(@BeanProperty var firstName: String,
@BeanProperty var lastName: String,
@BeanProperty var age: Int) {
override def toString: String = return format("%s, %s, %d", firstName, lastName, age)
}
That's a good start, and may work for most Scala JavaBean needs, but in case you need any more information, see my Scala JavaBean and BeanProperty tutorial on the devdaily.com website.
Reporting live from beautiful downtown Boulder, Colorado, this is Alvin Alexander.
Recent blog posts
- Good Scala programming resources (i.e., how to learn Scala)
- Over 150 Scala programming tutorials
- On software productivity and generating CRUD code
- CU Boulder team develops 'swarm' robots
- Generating CRUD forms for the Play Framework 2
- Great Scala learning resources
- Over 125 Scala tutorials
- Two new Scala video tutorials
- Mobiplug home connectivity (Boulder, Colorado), and SARAH
- My new book: 'You want me to do what? A Survival Guide for New Consultants'
