net.roydesign.ui.SystemProperty Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mrjadapter Show documentation
Show all versions of mrjadapter Show documentation
MRJ Adapter is a wrapper around built in Java Virtual Machine APIs provided by Apple.
The newest version!
package net.roydesign.ui;
public class SystemProperty {
private String key;
private String previousValue;
public static SystemProperty withKey(String key) {
SystemProperty systemProperty = new SystemProperty();
systemProperty.key = key;
return systemProperty;
}
public SystemProperty set() {
previousValue = System.getProperty(key);
System.setProperty(key, "true");
return this;
}
public void reset() {
if (previousValue == null) {
System.getProperties().remove(key);
} else {
System.setProperty(key, previousValue);
}
}
}