object Kson
Keyed simple object notation is a much simpler and more readable key value notation without needing quotes or commas, and intended for a single line
Kson (Key Separated Object Notation) is a simple format used for many of the configuration formats. The 'key' idea is to remain simple like CSV (Comma Separated Values). However, instead of using commas, use "<key>:" as the separation delimiter. Then instead of receiving a list of strings for a line of CSV you receive back key value pairs for a line of Kson. This provides for a flexible configuration and clean data encoding framework.
Where CSV returns an table of values, Kson can return a list of key value pairs per line or can squash all the key values together for a single key value lookup.
For example "person first:Aaron last:Radke language:scala desc:Use simple keys //with some comments" gets parsed to Map("/"" -> "person", "first" -> "Aaron", "last" -> "Radke", "language" -> "scala", "quote" -> "Use simple keys")
- Source
- kson.scala
- Alphabetic
- By Inheritance
- Kson
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply(files: Seq[File]): Kson
- def apply(in: Input): Kson
- def apply(string: String): Kson
- def apply(file: File): Kson
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def empty: Kson
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val interpolationPat: scala.util.matching.Regex
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def watch(file: File)(implicit ec: drx.ExecutionContext): Watched
### simple init val kson = Kson.watch(f)
### simple init val kson = Kson.watch(f)
### init with call back (not needed often since the config is backed by an hash trie cache to automatically hold the newest version) val kson = Kson.watch(f).onUpdate{k => println(kson("config.parameter") + "was upated")}
### delayed init (useful for a global config reference that has not been filled in with a separate file setup arguments) val kson = Kson.Watched.empty kson.update(File("config.kson")) //updates the file and starts a watcher
- object Watched
mutable that executes call backs on change modifications (call backs are added with
onUpdate
)