All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dylibso.chicory.maven.Specification Maven / Gradle / Ivy

package com.dylibso.chicory.maven;

import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Objects.requireNonNullElse;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

public class Specification {
    private final List args;
    private final List dirs;
    private final Map env;
    private final int exitCode;
    private final String stderr;
    private final String stdout;

    @JsonCreator
    public Specification(
            @JsonProperty("args") List args,
            @JsonProperty("dirs") List dirs,
            @JsonProperty("env") Map env,
            @JsonProperty("exit_code") int exitCode,
            @JsonProperty("stderr") String stderr,
            @JsonProperty("stdout") String stdout) {
        this.args = requireNonNullElse(args, emptyList());
        this.dirs = requireNonNullElse(dirs, emptyList());
        this.env = requireNonNullElse(env, emptyMap());
        this.exitCode = exitCode;
        this.stderr = requireNonNullElse(stderr, "");
        this.stdout = requireNonNullElse(stdout, "");
    }

    public List args() {
        return args;
    }

    public List dirs() {
        return dirs;
    }

    public Map env() {
        return env;
    }

    public int exitCode() {
        return exitCode;
    }

    public String stderr() {
        return stderr;
    }

    public String stdout() {
        return stdout;
    }

    public static Specification createDefault() {
        return new Specification(emptyList(), emptyList(), emptyMap(), 0, "", "");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy