Skip to content

Instantly share code, notes, and snippets.

@sonson
Created January 18, 2012 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonson/1632528 to your computer and use it in GitHub Desktop.
Save sonson/1632528 to your computer and use it in GitHub Desktop.
SnakeYaml Scala Test
package test.yaml
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.Constructor
import org.yaml.snakeyaml.introspector.BeanAccess
case class Project(name: String, url: String)
object App {
def main(args: Array[String]) {
val yaml = new Yaml(new Constructor(classOf[Project]))
yaml.setBeanAccess(BeanAccess.FIELD)
val project = yaml.load("name : abc\nurl : def").asInstanceOf[Project]
println("YAML READ DATA: " + project)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment