Example usage for java.lang Boolean toString

List of usage examples for java.lang Boolean toString

Introduction

In this page you can find the example usage for java.lang Boolean toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Boolean's value.

Usage

From source file:com.redhat.rhn.domain.common.SatConfigFactory.java

/**
 * set a satellite configuration value for a specified key
 * @param key key//from   w  w w  .  j  a v a  2 s  .  c o m
 * @param value value
 */
public static void setSatConfigBooleanValue(String key, Boolean value) {
    if (value == null) {
        setSatConfigValue(key, Boolean.FALSE.toString());
    } else {
        setSatConfigValue(key, value.toString());
    }
}

From source file:com.github.nakamurakj.validator.Validators.java

/**
 * ??/*from   w  ww . j  a  v  a  2  s .c  om*/
 *
 * @param string 
 * @return ???<code>true</code>
 */
public static boolean isBoolean(String string) {
    if (string != null) {
        for (Boolean value : BOOLEAN_VALUES) {
            if (value.toString().equals(string.toLowerCase())) {
                return true;
            }
        }
    }
    return false;
}

From source file:mitm.common.properties.HierarchicalPropertiesUtils.java

/**
 * Sets the boolean property named propertyName.
 *//*from ww  w . ja va 2s. co  m*/
public static void setBoolean(HierarchicalProperties properties, String propertyName, Boolean value,
        boolean encrypt) throws HierarchicalPropertiesException {
    properties.setProperty(propertyName, value != null ? value.toString() : null, encrypt);
}

From source file:edu.duke.cabig.c3pr.utils.StringUtils.java

public static String getBlankIfNull(Boolean bool) {
    if (bool == null)
        return "true";
    if (bool.toString().equals(""))
        return "true";
    return bool.toString();
}

From source file:com.sun.identity.openid.provider.Codec.java

/**
 * TODO: Description./*from   w w w  .ja  va2  s.  co m*/
 * 
 * @param value
 *            TODO.
 * @return TODO.
 */
public static String encodeBoolean(Boolean value) {
    if (value == null) {
        return null;
    }

    return value.toString();
}

From source file:com.hybris.mobile.Hybris.java

public static void setUserOnline(Boolean isLoggedIn) {
    Hybris.setSharedPreferenceString("user_online", isLoggedIn.toString());
}

From source file:org.opendatakit.briefcase.model.BriefcasePreferences.java

public static void setBriefcaseParallelPullsProperty(Boolean value) {
    if (value == null) {
        Preference.APPLICATION_SCOPED.remove(BRIEFCASE_PARALLEL_PULLS_PROPERTY);
    } else {/*from ww w. ja  v  a 2  s.  co  m*/
        Preference.APPLICATION_SCOPED.put(BRIEFCASE_PARALLEL_PULLS_PROPERTY, value.toString());
    }
}

From source file:fxts.stations.util.UserPreferences.java

public static String getStringValue(Boolean aValue) {
    return aValue.toString();
}

From source file:com.lhings.java.http.WebServiceCom.java

private static void startEndSession(LhingsDevice lhingsDevice, Boolean start)
        throws IOException, LhingsException {
    String url = LHINGS_V1_API_PREFIX + "devices/" + lhingsDevice.uuid() + "/states/online";
    String putBody = "{ \"name\": \"online\", \"value\": " + start.toString() + "}";
    executePut(lhingsDevice.apiKey(), url, putBody);
}

From source file:org.hyperic.hq.hqapi1.tools.Shell.java

static void initConnectionProperties(final String[] args) throws Exception {
    final List<String> connectionArgs = new ArrayList<String>(5);
    for (int i = 0; i < args.length; i++) {
        final String arg = args[i];
        if (arg.trim().startsWith("--" + OptionParserFactory.OPT_HOST)
                || arg.trim().startsWith("--" + OptionParserFactory.OPT_PORT)
                || arg.trim().startsWith("--" + OptionParserFactory.OPT_PASS)
                || arg.trim().startsWith("--" + OptionParserFactory.OPT_USER)
                || arg.trim().startsWith("--" + OptionParserFactory.OPT_SECURE[1])
                || arg.trim().equals("-" + OptionParserFactory.OPT_SECURE[0])
                || arg.trim().startsWith("--" + OptionParserFactory.OPT_PROPERTIES)) {
            connectionArgs.add(arg);//from ww  w.  j  ava  2s . c  o  m
            if (i != args.length - 1 && !(args[i + 1].startsWith("--"))) {
                connectionArgs.add(args[i + 1]);
            }
        }
    }
    final OptionParser optionParser = (OptionParser) new OptionParserFactory().getObject();
    final OptionSet options = optionParser.parse(connectionArgs.toArray(new String[connectionArgs.size()]));

    Properties clientProps = getClientProperties((String) options.valueOf(OptionParserFactory.OPT_PROPERTIES));

    String host = (String) options.valueOf(OptionParserFactory.OPT_HOST);
    if (host == null) {
        host = clientProps.getProperty(OptionParserFactory.OPT_HOST);
    }
    if (host != null) {
        System.setProperty(OptionParserFactory.SYSTEM_PROP_PREFIX + OptionParserFactory.OPT_HOST, host);
    }

    Integer port;
    if (options.hasArgument(OptionParserFactory.OPT_PORT)) {
        port = (Integer) options.valueOf(OptionParserFactory.OPT_PORT);
    } else {
        port = Integer.parseInt(clientProps.getProperty(OptionParserFactory.OPT_PORT, "7080"));
    }
    if (port != null) {
        System.setProperty(OptionParserFactory.SYSTEM_PROP_PREFIX + OptionParserFactory.OPT_PORT,
                port.toString());
    }

    String user = (String) options.valueOf(OptionParserFactory.OPT_USER);
    if (user == null) {
        user = clientProps.getProperty(OptionParserFactory.OPT_USER);
    }
    if (user != null) {
        System.setProperty(OptionParserFactory.SYSTEM_PROP_PREFIX + OptionParserFactory.OPT_USER, user);
    }

    String password = (String) options.valueOf(OptionParserFactory.OPT_PASS);
    if (password == null) {
        password = clientProps.getProperty(OptionParserFactory.OPT_PASS);
        // Check for encrypted password
        if (password == null || password.isEmpty()) {
            String encryptionKey = clientProps.getProperty(OptionParserFactory.OPT_ENCRYPTIONKEY);
            String encryptedPassword = clientProps.getProperty(OptionParserFactory.OPT_ENCRYPTEDPASSWORD);
            if (null != encryptionKey && null != encryptedPassword) {
                password = decryptPassword(encryptedPassword, encryptionKey);
            }
        }
    }

    if (host != null && port != null && user != null && password == null) {
        // Prompt for password, but only if other connection properties
        // have been specified.
        try {
            char[] passwordArray = PasswordField.getPassword(System.in, "Enter password: ");
            password = String.valueOf(passwordArray);
        } catch (IOException ioe) {
            System.err.println("Error reading password");
            System.exit(-1);
        }
    }
    if (password != null) {
        System.setProperty(OptionParserFactory.SYSTEM_PROP_PREFIX + OptionParserFactory.OPT_PASS, password);
    }

    Boolean secure = options.has(OptionParserFactory.OPT_SECURE[0])
            || options.has(OptionParserFactory.OPT_SECURE[1])
            || Boolean.valueOf(clientProps.getProperty(OptionParserFactory.OPT_SECURE[1], "false"));
    System.setProperty(OptionParserFactory.SYSTEM_PROP_PREFIX + OptionParserFactory.OPT_SECURE[1],
            secure.toString());
}