Example usage for com.jgoodies.common.base Strings isEmpty

List of usage examples for com.jgoodies.common.base Strings isEmpty

Introduction

In this page you can find the example usage for com.jgoodies.common.base Strings isEmpty.

Prototype

public static boolean isEmpty(String str) 

Source Link

Document

Checks if the given string is empty ("") or null .

Usage

From source file:com.thoughtworks.gauge.execution.GaugeRunConfiguration.java

License:Open Source License

private void addProgramArguments(GeneralCommandLine commandLine) {
    if (programParameters == null) {
        return;//from  www .j av  a 2 s.  c o m
    }
    String parameters = programParameters.getProgramParameters();
    if (!Strings.isEmpty(parameters)) {
        commandLine.addParameters(programParameters.getProgramParameters().split(" "));
    }
    Map<String, String> envs = programParameters.getEnvs();
    if (!envs.isEmpty()) {
        commandLine.withEnvironment(envs);
    }
    if (Strings.isNotEmpty(programParameters.getWorkingDirectory())) {
        commandLine.setWorkDirectory(new File(programParameters.getWorkingDirectory()));
    }
}

From source file:com.thoughtworks.gauge.execution.GaugeRunConfiguration.java

License:Open Source License

private void addParallelExecFlags(GeneralCommandLine commandLine, ExecutionEnvironment env) {
    if (parallelExec(env)) {
        commandLine.addParameter(Constants.PARALLEL);
        try {//  w  ww  . j a  va 2s . c o  m
            if (!Strings.isEmpty(parallelNodes)) {
                Integer.parseInt(this.parallelNodes);
                commandLine.addParameters(Constants.PARALLEL_NODES, parallelNodes);
            }
        } catch (NumberFormatException e) {
            System.err.println("Incorrect number of parallel execution streams specified: " + parallelNodes);
            e.printStackTrace();
        }
    }
}

From source file:org.epri.pt2.dnp3proxy.DNP3ProxyConfigurationPanel.java

License:Open Source License

public ValidationResult validateInput() {
    ValidationResult validationResult = new ValidationResult();

    if (Strings.isEmpty(proxyAddress.getText())) {
        validationResult.addError("The proxy address field can not be blank.");
    } else {//from   ww  w . j  av a  2s  .  c om
        String address = proxyAddress.getText();

        Matcher matcher = addressPattern.matcher(address);

        if (!matcher.matches()) {
            validationResult.addWarning("The proxy address field must be a valid ip address or hostname.");
        }
    }

    if (Strings.isEmpty(proxyPort.getText())) {
        validationResult.addError("The proxy port field can not be blank.");
    }

    try {
        if (Integer.parseInt(proxyPort.getText()) < 1) {
            validationResult.addError("The proxy port must be a number in the range of 1-65535.");
        }
    } catch (NumberFormatException e) {
        validationResult.addError("The proxy port must be a number in the range of 1-65535.");
    }
    /*
     * if (Strings.isEmpty(nameText.getText())) {
     * validationResult.addError("The name field can not be blank."); }
     * 
     * if (Strings.isEmpty(descText.getText())) { validationResult
     * .addInfo("Please add a description to the project."); }
     */

    return validationResult;
}

From source file:org.epri.pt2.proxy.ProxyConfigurationPanel.java

License:Open Source License

public ValidationResult validateInput() {

    /*/* ww  w . j  av  a  2s .  c  om*/
     * proxyConfigPanel.add(proxyEnabledLabel);
     * proxyConfigPanel.add(proxyEnabled);
     * proxyConfigPanel.add(sslEnabledLabel);
     * proxyConfigPanel.add(sslEnabled);
     * proxyConfigPanel.add(proxyAddressLabel);
     * proxyConfigPanel.add(proxyAddress);
     * proxyConfigPanel.add(proxyPortLabel);
     * proxyConfigPanel.add(proxyPort);
     */

    ValidationResult validationResult = new ValidationResult();

    if (Strings.isEmpty(proxyAddress.getText())) {
        validationResult.addError("The proxy address field can not be blank.");
    } else {
        String address = proxyAddress.getText();

        Matcher matcher = addressPattern.matcher(address);

        if (!matcher.matches()) {
            validationResult.addWarning("The proxy address field must be a valid ip address or hostname.");
        }
    }

    if (Strings.isEmpty(proxyPort.getText())) {
        validationResult.addError("The proxy port field can not be blank.");
    }

    try {
        if (Integer.parseInt(proxyPort.getText()) < 1) {
            validationResult.addError("The proxy port must be a number in the range of 1-65535.");
        }
    } catch (NumberFormatException e) {
        validationResult.addError("The proxy port must be a number in the range of 1-65535.");
    }
    /*
     * if (Strings.isEmpty(nameText.getText())) {
     * validationResult.addError("The name field can not be blank."); }
     * 
     * if (Strings.isEmpty(descText.getText())) { validationResult
     * .addInfo("Please add a description to the project."); }
     */

    return validationResult;
}