The wrapper for the primitive type boolean. @since 1.0
| 25 | * @since 1.0 |
| 26 | */ |
| 27 | public final class Boolean implements Serializable, Comparable<Boolean> { |
| 28 | |
| 29 | private static final long serialVersionUID = -3665804199014368530L; |
| 30 | |
| 31 | /** |
| 32 | * The boolean value of the receiver. |
| 33 | */ |
| 34 | private final boolean value; |
| 35 | |
| 36 | /** |
| 37 | * The {@link Class} object that represents the primitive type {@code |
| 38 | * boolean}. |
| 39 | */ |
| 40 | @SuppressWarnings("unchecked") |
| 41 | public static final Class<Boolean> TYPE = (Class<Boolean>) new boolean[0] |
| 42 | .getClass().getComponentType(); |
| 43 | |
| 44 | // Note: This can't be set to "boolean.class", since *that* is |
| 45 | // defined to be "java.lang.Boolean.TYPE"; |
| 46 | |
| 47 | /** |
| 48 | * The {@code Boolean} object that represents the primitive value |
| 49 | * {@code true}. |
| 50 | */ |
| 51 | public static final Boolean TRUE = new Boolean(true); |
| 52 | |
| 53 | /** |
| 54 | * The {@code Boolean} object that represents the primitive value |
| 55 | * {@code false}. |
| 56 | */ |
| 57 | public static final Boolean FALSE = new Boolean(false); |
| 58 | |
| 59 | /** |
| 60 | * Constructs a new {@code Boolean} with its boolean value specified by |
| 61 | * {@code string}. If {@code string} is not {@code null} and is equal to |
| 62 | * "true" using a non-case sensitive comparison, the result will be a |
| 63 | * Boolean representing the primitive value {@code true}, otherwise it will |
| 64 | * be a Boolean representing the primitive value {@code false}. |
| 65 | * |
| 66 | * @param string |
| 67 | * the string representing a boolean value. |
| 68 | */ |
| 69 | public Boolean(String string) { |
| 70 | this(parseBoolean(string)); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Constructs a new {@code Boolean} with the specified primitive boolean |
| 75 | * value. |
| 76 | * |
| 77 | * @param value |
| 78 | * the primitive boolean value, {@code true} or {@code false}. |
| 79 | */ |
| 80 | public Boolean(boolean value) { |
| 81 | this.value = value; |
| 82 | } |
| 83 | |
| 84 | /** |
nothing calls this directly
no test coverage detected