/** * Returns a {@code Boolean} with a value represented by the * specified string. The {@code Boolean} returned represents a * true value if the string argument is not {@code null} * and is equal, ignoring case, to the string {@code "true"}. * * @param s a string. * @return the {@code Boolean} value represented by the string. */ public static Boolean valueOf(String s) { return toBoolean(s) ? TRUE : FALSE; }
/** * Returns a {@code Boolean} with a value represented by the * specified string. The {@code Boolean} returned represents a * true value if the string argument is not {@code null} * and is equal, ignoring case, to the string {@code "true"}. * * @param s a string. * @return the {@code Boolean} value represented by the string. */ public static Boolean valueOf(String s) { return toBoolean(s) ? TRUE : FALSE; }
/** * Parses the string argument as a boolean. The {@code boolean} * returned represents the value {@code true} if the string argument * is not {@code null} and is equal, ignoring case, to the string * {@code "true"}. <p> * Example: {@code Boolean.parseBoolean("True")} returns {@code true}.<br> * Example: {@code Boolean.parseBoolean("yes")} returns {@code false}. * * @param s the {@code String} containing the boolean * representation to be parsed * @return the boolean represented by the string argument * @since 1.5 */ public static boolean parseBoolean(String s) { return toBoolean(s); }
/** * Allocates a {@code Boolean} object representing the value * {@code true} if the string argument is not {@code null} * and is equal, ignoring case, to the string {@code "true"}. * Otherwise, allocate a {@code Boolean} object representing the * value {@code false}. Examples:<p> * {@code new Boolean("True")} produces a {@code Boolean} object * that represents {@code true}.<br> * {@code new Boolean("yes")} produces a {@code Boolean} object * that represents {@code false}. * * @param s the string to be converted to a {@code Boolean}. */ public Boolean(String s) { this(toBoolean(s)); }
/** * Allocates a {@code Boolean} object representing the value * {@code true} if the string argument is not {@code null} * and is equal, ignoring case, to the string {@code "true"}. * Otherwise, allocate a {@code Boolean} object representing the * value {@code false}. Examples:<p> * {@code new Boolean("True")} produces a {@code Boolean} object * that represents {@code true}.<br> * {@code new Boolean("yes")} produces a {@code Boolean} object * that represents {@code false}. * * @param s the string to be converted to a {@code Boolean}. */ public Boolean(String s) { this(toBoolean(s)); }
/** * Parses the string argument as a boolean. The {@code boolean} * returned represents the value {@code true} if the string argument * is not {@code null} and is equal, ignoring case, to the string * {@code "true"}. <p> * Example: {@code Boolean.parseBoolean("True")} returns {@code true}.<br> * Example: {@code Boolean.parseBoolean("yes")} returns {@code false}. * * @param s the {@code String} containing the boolean * representation to be parsed * @return the boolean represented by the string argument * @since 1.5 */ public static boolean parseBoolean(String s) { return toBoolean(s); }
/** * Returns {@code true} if and only if the system property * named by the argument exists and is equal to the string * {@code "true"}. (Beginning with version 1.0.2 of the * Java<small><sup>TM</sup></small> platform, the test of * this string is case insensitive.) A system property is accessible * through {@code getProperty}, a method defined by the * {@code System} class. * <p> * If there is no property with the specified name, or if the specified * name is empty or null, then {@code false} is returned. * * @param name the system property name. * @return the {@code boolean} value of the system property. * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.System#getProperty(java.lang.String, java.lang.String) */ public static boolean getBoolean(String name) { boolean result = false; try { result = toBoolean(AbstractStringBuilder.getProperty(name)); } catch (IllegalArgumentException e) { } catch (NullPointerException e) { } return result; }
/** * Returns {@code true} if and only if the system property * named by the argument exists and is equal to the string * {@code "true"}. (Beginning with version 1.0.2 of the * Java<small><sup>TM</sup></small> platform, the test of * this string is case insensitive.) A system property is accessible * through {@code getProperty}, a method defined by the * {@code System} class. * <p> * If there is no property with the specified name, or if the specified * name is empty or null, then {@code false} is returned. * * @param name the system property name. * @return the {@code boolean} value of the system property. * @see java.lang.System#getProperty(java.lang.String) * @see java.lang.System#getProperty(java.lang.String, java.lang.String) */ public static boolean getBoolean(String name) { boolean result = false; try { result = toBoolean(AbstractStringBuilder.getProperty(name)); } catch (IllegalArgumentException e) { } catch (NullPointerException e) { } return result; }