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

flabbergast.SettingsHandler Maven / Gradle / Ivy

package flabbergast;

import java.net.URLDecoder;

import flabbergast.TaskMaster.LibraryFailure;

public class SettingsHandler implements UriHandler {
    public static final SettingsHandler INSTANCE = new SettingsHandler();
    private SettingsHandler() {
    }

    public String getUriName() {
        return "VM-specific settings";
    }

    public Computation resolveUri(TaskMaster task_master, String uri,
                                  Ptr reason) {

        if (!uri.startsWith("settings:"))
            return null;
        try {
            String value = System.getProperty(URLDecoder.decode(uri.substring(9), "UTF-8"));
            return new Precomputation(value == null ? Unit.NULL : new SimpleStringish(value));
        } catch (Exception e) {
            return new FailureComputation(task_master, new NativeSourceReference(uri), e.getMessage());
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy