juan_gandhi: (Default)
Juan-Carlos Gandhi ([personal profile] juan_gandhi) wrote2012-05-02 02:34 pm
Entry tags:

yet another scala kitten

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
def retrieveProps(c: Container, file: String) {
  val prop = new {
    def apply(key: String) = c.getPropertyOrFail(key,
      throw new IllegalArgumentException(
         "missing " + key + " in " + file)).getValue
  }

  val name = prop("username")
  val pass = prop("password")
  val db   = prop("database")
}

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting