Skip to content

Instantly share code, notes, and snippets.

@alinpopa
Created August 30, 2012 12:32
Show Gist options
  • Save alinpopa/3527590 to your computer and use it in GitHub Desktop.
Save alinpopa/3527590 to your computer and use it in GitHub Desktop.
test2
package org.test.uml
case class Object(name: String) {
def --(message: String) = (this, message)
def <--(message: String) = (this, message)
}
sealed trait Action
sealed case class Call(source: Object, verb: String, destination: Object) extends Action
sealed case class Async(source: Object, verb: String, destination: Object) extends Action
object implicits {
class Sourceable(source: Object, action: String) {
def -->(target: Object) = Call(source, action, target)
def <--(target: Object) = Call(target, action, source)
}
implicit def toSourceable(tuple: (Object, String)) = new Sourceable(tuple._1, tuple._2)
}
object Uml {
import implicits._
def main(args: Array[String]): Unit = {
val bob = Object("Bob")
val dan = Object("Dan")
println(List(
bob -- "salutes" --> dan,
dan -- "respondes" <-- bob
))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment