aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/shedlang/compiler/config/ProfileConfig.java
blob: d922a4cbe4f742d8374af3f5effd45bc29f40a72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package org.shedlang.compiler.config;

import org.shedlang.compiler.config.json.Json5ObjectWithSource;

import java.util.Optional;

public record ProfileConfig(String name, Optional<GcConfig> gc) {
    public static final ProfileConfig DEFAULT = new ProfileConfig("dev", Optional.empty());

    public static ProfileConfig fromJson5(Json5ObjectWithSource object) {
        var name = object.getString("name").value();
        var gc = object.getObject("gc").map(GcConfig::fromJson5);

        return new ProfileConfig(name, gc);
    }
}