Skip to content

Instantly share code, notes, and snippets.

@aalmiray
Created September 1, 2010 15:16
Show Gist options
  • Save aalmiray/560836 to your computer and use it in GitHub Desktop.
Save aalmiray/560836 to your computer and use it in GitHub Desktop.
package a
import org.codehaus.griffon.runtime.core.AbstractGriffonModel
class AModel extends AbstractGriffonModel {
var input: String = ""
var output: String = ""
// must make getters/setters explicit so that the Griffon runtime
// can call the appropriate method. Scala follows a non-JavaBeans
// convention for defining properties
def getInput():String = input
def setInput(in: String) = firePropertyChange("input", input, input = in)
def getOutput():String = output
def setOutput(out: String) = firePropertyChange("output", output, output = out)
}
@fedesilva
Copy link

You might want to use @BeanProperty instead of the explicit get/get function pairs.
http://www.scala-lang.org/api/current/scala/reflect/BeanProperty.html

@aalmiray
Copy link
Author

aalmiray commented Sep 1, 2010

I did but sadly @BeanProperty is not smart enough to figure out that I have written a custom setter and fails with a compiler error stating that setInput() has been defined twice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment