Scala domain models and td4j

2010-09-04 by mira

I started to write Scala versions of the td4j examples.

td4j recognizes setter and getter methods following the Java Bean convention, so I use the @BeanProperty annotation where appropriate.

Here is how the td4j HelloWorld example looks like in Scala:

import org.td4j.swing.workbench.Workbench
import reflect.BeanProperty

object HelloWorldExample {

  def main(args : Array[String]) {
    Workbench.start(new HelloWorld)

  class HelloWorld {
    @BeanProperty var name = "world"

    def getGreeting = String.format("Hello %s!", name)