
fitnesse.wiki.SystemVariableSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fitnesse Show documentation
Show all versions of fitnesse Show documentation
The fully integrated standalone wiki, and acceptance testing framework.
package fitnesse.wiki;
import java.util.Properties;
import fitnesse.wikitext.parser.Maybe;
import fitnesse.wikitext.parser.VariableSource;
public class SystemVariableSource implements VariableSource {
private final Properties properties;
public SystemVariableSource(Properties properties) {
this.properties = properties;
}
public SystemVariableSource() {
this(null);
}
@Override
public Maybe findVariable(String name) {
String result = getProperty(name);
if (result == null) return Maybe.noString;
return new Maybe<>(result);
}
public String getProperty(String name) {
String p = System.getenv(name);
if (p != null) return p;
p = System.getProperty(name);
if (p != null) return p;
return properties != null ? properties.getProperty(name) : null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy