org.scalamacros.paradise.Settings.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of paradise_2.12.20 Show documentation
Show all versions of paradise_2.12.20 Show documentation
Empowers production Scala compiler with latest macro developments
The newest version!
package org.scalamacros.paradise
object Settings {
class Setting[T](get: () => T, set: T => Unit) {
def value = get()
def value_=(value: T) = set(value)
}
def boolSetting(key: String) = new Setting[Boolean](
get = () => {
val svalue = System.getProperty("macroparadise." + key)
svalue != null
},
set = value => {
val svalue = if (value) "true" else null
System.setProperty("macroparadise." + key, svalue)
}
)
}