Created
January 18, 2012 11:23
-
-
Save sonson/1632528 to your computer and use it in GitHub Desktop.
SnakeYaml Scala Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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