Liking cljdoc? Tell your friends :D

java-properties.core


env-propsclj

(env-props)

Returns all system properties as a Clojure map.

Returns all system properties as a Clojure map.
sourceraw docstring

kebab-conf-to-camelcaseclj

(kebab-conf-to-camelcase conf)

Converts all kebab-case keys in a map to camelCase.

Example: {:my-key-name "val"} => {:myKeyName "val"}

Converts all kebab-case keys in a map to camelCase.

Example: {:my-key-name "val"} => {:myKeyName "val"}
sourceraw docstring

load-configclj

(load-config app-name & [{:keys [config] :as options}])

Loads and parses a Java properties file into a nested Clojure data structure.

This function is the main entry point for the library. It loads a .properties file from the classpath and converts it into a nested Clojure map structure.

Features:

  • Converts dotted keys (a.b.c) into nested maps {:a {:b {:c ...}}}
  • Supports array notation: foo[0], foo[1] or foo.0, foo.1
  • Extracts quoted strings: foo."my.key" preserves dots in key names
  • Applies system property overrides (-Dkey=value)
  • Optionally converts numeric indices to vectors
  • Thread-safe with no global state

Parameters: app-name - Name of the properties file (without .properties extension) Searched in classpath resources (e.g., "test" -> "test.properties") options - Optional map with keys: :with-arrays - When true, numeric indices converted to vectors Example: {:servers {:0 ...}} => {:servers [...]} :config - Path to the external properties file to merge/override Can be a relative or absolute path

Returns: Nested map representing the configuration hierarchy

Examples: ; Basic usage (load-config "myapp") => {:database {:host "localhost", :port 5432}}

; With array conversion (load-config "myapp" {:with-arrays true}) => {:servers [{:name "srv1"} {:name "srv2"}]}

; With external override file (load-config "myapp" {:config "./override.properties"}) => merged configuration with external overrides

Thread Safety: This function is fully thread-safe. Multiple threads can call load-config concurrently without any risk of race conditions or state corruption. All states are local to the function call.

Performance: Typical performance: ~1-5ms for small configs (<100 properties) ~10-50ms for large configs (1000+ properties)

Loads and parses a Java properties file into a nested Clojure data structure.

This function is the main entry point for the library. It loads a .properties
file from the classpath and converts it into a nested Clojure map structure.

Features:
- Converts dotted keys (a.b.c) into nested maps {:a {:b {:c ...}}}
- Supports array notation: foo[0], foo[1] or foo.0, foo.1
- Extracts quoted strings: foo."my.key" preserves dots in key names
- Applies system property overrides (-Dkey=value)
- Optionally converts numeric indices to vectors
- Thread-safe with no global state

Parameters:
  app-name - Name of the properties file (without .properties extension)
             Searched in classpath resources (e.g., "test" -> "test.properties")
  options  - Optional map with keys:
             :with-arrays - When true, numeric indices converted to vectors
                            Example: {:servers {:0 ...}} => {:servers [...]}
             :config - Path to the external properties file to merge/override
                            Can be a relative or absolute path

Returns:
  Nested map representing the configuration hierarchy

Examples:
  ; Basic usage
  (load-config "myapp")
  => {:database {:host "localhost", :port 5432}}
  
  ; With array conversion
  (load-config "myapp" {:with-arrays true})
  => {:servers [{:name "srv1"} {:name "srv2"}]}
  
  ; With external override file
  (load-config "myapp" {:config "./override.properties"})
  => merged configuration with external overrides

Thread Safety:
  This function is fully thread-safe. Multiple threads can call load-config
  concurrently without any risk of race conditions or state corruption.
  All states are local to the function call.

Performance:
  Typical performance: ~1-5ms for small configs (<100 properties)
                      ~10-50ms for large configs (1000+ properties)
sourceraw docstring

load-propsclj

(load-props file)

Loads a Java properties file and applies system property overrides.

Parameters: file - Path to properties file (as File, URL, or String)

Returns: Map of property key-value pairs with EDN parsing applied where possible.

Loads a Java properties file and applies system property overrides.

Parameters:
  file - Path to properties file (as File, URL, or String)
  
Returns:
  Map of property key-value pairs with EDN parsing applied where possible.
sourceraw docstring

merge-commonclj

(merge-common d keyword)

Merges a common configuration section into all other sections.

Example: (merge-common {:common {:timeout 30} :api {:host "localhost"}} :common) => {:api {:timeout 30, :host "localhost"}}

Merges a common configuration section into all other sections.

Example:
  (merge-common {:common {:timeout 30} :api {:host "localhost"}} :common)
  => {:api {:timeout 30, :host "localhost"}}
sourceraw docstring

ordered-configsclj

(ordered-configs d)

Converts a map of configs into a sorted sequence with :key added to each.

Example: (ordered-configs {:b {...} :a {...}}) => ({:key :a, ...} {:key :b, ...})

Converts a map of configs into a sorted sequence with :key added to each.

Example:
  (ordered-configs {:b {...} :a {...}})
  => ({:key :a, ...} {:key :b, ...})
sourceraw docstring

parse-java-util-dateclj

(parse-java-util-date s)

Parses an ISO-8601 formatted date-time string into java.util.Date.

Supports multiple formats with optional milliseconds/microseconds.

Example: (parse-java-util-date "2024-01-19T10:30:00.000Z")

Parses an ISO-8601 formatted date-time string into java.util.Date.

Supports multiple formats with optional milliseconds/microseconds.

Example: (parse-java-util-date "2024-01-19T10:30:00.000Z")
sourceraw docstring

prettyclj

(pretty & args)

Pretty-prints one or more data structures and returns the formatted string.

Pretty-prints one or more data structures and returns the formatted string.
sourceraw docstring

split-comma-separatedclj

(split-comma-separated s)

Splits a comma-separated string and trims whitespace from each element.

Example: (split-comma-separated "a, b,c , d") => ["a" "b" "c" "d"]

Splits a comma-separated string and trims whitespace from each element.

Example: (split-comma-separated "a, b,c  , d") => ["a" "b" "c" "d"]
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close