« Return to Thread: Q: MOP, aspects, setter methods

Re: Q: MOP, aspects, setter methods

by grkuntzmd :: Rate this Message:

Reply to Author | View in Thread

I just tried this and it worked:
class Parent {
  void setProperty(String name, value) {
    println "Setting $name to $value"
    this.@"$name" = value
  }
}

class Child extends Parent {
  def field
}

def c = new Child()
c.field = 4
assert c.field == 4
It printed "Setting field to 4". This might just solve my problem.
G. Ralph Kuntz, MD

 « Return to Thread: Q: MOP, aspects, setter methods