Define a Java config property of the form -Dcircumspec.name=...
Constructor, if specified, converts and validates from string
to the type needed.
(defmacro defconfig
"Define a Java config property of the form -Dcircumspec.name=...
Constructor, if specified, converts and validates from string
to the type needed."
([name docs default-value]
`(defconfig ~name ~docs ~default-value identity))
([name docs default-value constructor]
(assert (symbol? name))
(assert (string? docs))
(assert (string? default-value))
`(defn ~name
~(str docs "\nDefault value is " default-value
"\nSpecify using -Dcircumspec." name "=...")
[]
(~constructor
(System/getProperty ~(str "circumspec." name) ~default-value)))))
Comments top
No comments for defconfig. Log in to add a comment.