ConfigExtractors

Type-safe configuration of value extractors. Each method removes the value from the map and returns null if not present.

All extractors follow the same contract:

  • If the key is absent or null, return null (allows caller to use default)

  • If the key exists, remove it from the map (for detecting unused keys)

  • If the value has wrong type, throw ConfigurationException with field context

Functions

Link copied to clipboard
inline fun <T : Enum<*>> extractEnum(field: String, map: MutableMap<String, Any?>): T?

Extracts and validates an Enum value. Supports both the enum type directly and String values. String matching is case-insensitive and converts hyphens to underscores.

Link copied to clipboard
fun extractInteger(field: String, map: MutableMap<String, Any?>): Int?

Extracts and validates an Integer value. Supports Int, Long, Number, and numeric String inputs.

Link copied to clipboard

Extracts and validates a String value.

Link copied to clipboard

Extracts and validates a Map value. Values in the map must be non-null.

Link copied to clipboard

Extracts and validates a Map value.

Link copied to clipboard

Extracts and validates a List value from a Collection.

Link copied to clipboard

Extracts and validates a Set value from a Collection.

Link copied to clipboard

Extracts and validates a Map value.