src/main/java/de/unixwork/uwproj/PkgConfigPackage.java

Sat, 27 Jan 2024 14:28:09 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 27 Jan 2024 14:28:09 +0100
changeset 109
1e852be12654
parent 91
f14d77dd4215
child 113
24f32dbd88cd
permissions
-rw-r--r--

adds schema validation - fixes #291

package de.unixwork.uwproj;

import org.w3c.dom.Element;

public class PkgConfigPackage {
    private String id;
    private String name;
    private String atleast;
    private String exact;
    private String max;

    public static PkgConfigPackage parse(Element e) throws Exception {
        var p = new PkgConfigPackage();
        String name = Util.getContent(e);
        if (name.isBlank()) {
            throw new Exception("pkgconfig element: value required");
        } else {
            p.setName(name);
            p.setId(Util.shId(name));
        }
        p.setAtleast(e.getAttribute("atleast"));
        p.setExact(e.getAttribute("exact"));
        p.setMax(e.getAttribute("max"));
        return p;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAtleast() {
        return atleast;
    }

    public void setAtleast(String atleast) {
        this.atleast = atleast;
    }

    public String getMax() {
        return max;
    }

    public void setMax(String max) {
        this.max = max;
    }

    public String getExact() {
        return exact;
    }

    public void setExact(String exact) {
        this.exact = exact;
    }
}

mercurial