Mapping

KissConfig maps the merged and interpolated ConfigMap to a Java object. In v0.1.0, Java records are the supported target type.

Records

Records are recommended because they are immutable, constructor-bound, and explicit.

public record AppConfig(ServerConfig server, DatabaseConfig database) {}
public record ServerConfig(String host, int port) {}
public record DatabaseConfig(String url) {}
server.host=0.0.0.0
server.port=8080
database.url=jdbc:postgresql://localhost:5432/app
AppConfig config = KissConfig.load(AppConfig.class);

Normal Java Classes

Normal JavaBeans, field-based classes, setters, and arbitrary constructors are not supported in v0.1.0.

The mapper rejects non-record target types with ConfigMappingException.

This is intentional for the first release. It keeps mapping deterministic and avoids a larger reflection surface. Support for simple JavaBeans or field-based classes is tracked in the roadmap.

Constructor And Field Behavior

For records, KissConfig reads record components and calls the canonical record constructor.

It does not set fields directly. It does not call setters. It does not bind arbitrary constructors.

Nested Records

Nested records map from dot-prefixed keys:

public record AppConfig(ServerConfig server) {}
public record ServerConfig(String host, int port) {}
server.host=0.0.0.0
server.port=8080

If any keys exist under the nested prefix, KissConfig maps the nested record. If no keys exist, the nested record component is null unless it is @Required.

Missing Values

Target component Missing behavior
primitive without @DefaultValue ConfigMissingPropertyException
wrapper/object without @Required null
wrapper/object with @Required ConfigMissingPropertyException
nested record with keys under prefix nested mapping
nested record without keys null unless @Required

Supported Types

Booleans

Accepted values:

Durations

Accepted values:

Dates And Times

KissConfig delegates to Java time parsers:

Enums

Enum conversion is case-insensitive and treats dashes as underscores.

enum Mode {
    DEV,
    PROD
}

public record AppConfig(Mode mode) {}
mode=prod

Lists And Arrays

Lists are comma-separated and trimmed:

allowed.origins=https://a.example, https://b.example
public record CorsConfig(List<String> allowedOrigins) {}

Escaped commas are not supported in v0.1.0.

Arrays are supported for scalar component types:

public record TagsConfig(String[] tags) {}

Annotations

Mapping supports record-component annotations:

public record ServerConfig(
        @ConfigName("server.host") String host,
        @DefaultValue("8080") int port,
        @Required String name,
        @Secret String token
) {}

Unsupported Targets

Unsupported in v0.1.0: