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

Sun, 03 Sep 2023 12:24:39 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 03 Sep 2023 12:24:39 +0200
changeset 35
57ea620a54ac
parent 7
686991ae6e2f
child 40
b42bfc9e9983
permissions
-rw-r--r--

fix several unquoted variable uses

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package de.unixwork.uwproj;

import org.w3c.dom.Element;

/**
 *
 * @author olaf
 */
public class ConfigVar {
    String name;
    String value;
    private boolean exec = false;
    
    public static ConfigVar parse(Element e) {
        ConfigVar var = new ConfigVar();
        
        String name = e.getAttribute("name");
        if(name == null || name.length() == 0) {
            System.err.println("<var>-element: name attribute required");
            return null;
        }
        var.name = name;
        
        String value = Xml.getContent(e);
        var.value = value == null ? "" : value;
        
        String type = e.getAttribute("type");
        if(type != null && type.equals("exec")) {
            var.exec = true;
        }
        
        return var;
    }
    
    public String getName() {
        return name;
    }

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

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public boolean isExec() {
        return exec;
    }
}

mercurial