Example usage for java.lang Boolean booleanValue

List of usage examples for java.lang Boolean booleanValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public boolean booleanValue() 

Source Link

Document

Returns the value of this Boolean object as a boolean primitive.

Usage

From source file:Main.java

@SuppressWarnings({ "rawtypes", "unchecked" })
public static boolean createBond(BluetoothDevice btDevice) throws Exception {
    Class class1 = Class.forName("android.bluetooth.BluetoothDevice");
    Method createBondMethod = class1.getMethod("createBond");
    Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice);
    return returnValue.booleanValue();
}

From source file:Main.java

@SuppressWarnings("unchecked")
static public boolean createBond(@SuppressWarnings("rawtypes") Class btClass, BluetoothDevice btDevice)
        throws Exception {
    Method createBondMethod = btClass.getMethod("createBond");
    Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice);
    return returnValue.booleanValue();
}

From source file:Main.java

public static boolean setPairingConfirmation(Class btClass, BluetoothDevice device, boolean confirm)
        throws Exception {
    Method setPairiConfirmMethod = btClass.getMethod("setPairingConfirmation", boolean.class);
    Boolean retVal = (Boolean) setPairiConfirmMethod.invoke(device, confirm);
    return retVal.booleanValue();
}

From source file:Main.java

public static boolean nullAs(Boolean boolean1, boolean flag) {
    if (boolean1 != null)
        flag = boolean1.booleanValue();
    return flag;/* w  ww.ja v a  2s . c om*/
}

From source file:Main.java

public static boolean isBoolean(Boolean value) {
    if (value == null)
        return false;
    return value.booleanValue();
}

From source file:Main.java

/**
 * unbox Boolean//ww w  .j a  v  a  2s  . com
 */
public static boolean unboxed(Boolean v) {
    return v == null ? false : v.booleanValue();
}

From source file:Main.java

public static boolean evaluateXPathBool(Node InNode, String xpath) throws Exception {
    Boolean B = (Boolean) getNodesListXpath(xpath, InNode, "", "", XPathConstants.BOOLEAN);
    return B.booleanValue();
}

From source file:Main.java

/**
 * <p>Checks if a <code>Boolean</code> value is <code>true</code>,
 * handling <code>null</code> by returning <code>false</code>.</p>
 *
 * <pre>/*from ww w . j  a  v  a2s  .  c o m*/
 *   BooleanUtils.isTrue(Boolean.TRUE)  = true
 *   BooleanUtils.isTrue(Boolean.FALSE) = false
 *   BooleanUtils.isTrue(null)          = false
 * </pre>
 *
 * @param bool  the boolean to check, null returns <code>false</code>
 * @return <code>true</code> only if the input is non-null and true
 * @since 2.1
 */
public static boolean isTrue(Boolean bool) {
    if (bool == null) {
        return false;
    }
    return bool.booleanValue() ? true : false;
}

From source file:Main.java

/**
 * <p>Negates the specified boolean.</p>
 * /* w  w w .j  a v  a  2s . c  om*/
 * <p>If <code>null</code> is passed in, <code>null</code> will be returned.</p>
 *
 * <pre>
 *   BooleanUtils.negate(Boolean.TRUE)  = Boolean.FALSE;
 *   BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE;
 *   BooleanUtils.negate(null)          = null;
 * </pre>
 * 
 * @param bool  the Boolean to negate, may be null
 * @return the negated Boolean, or <code>null</code> if <code>null</code> input
 */
public static Boolean negate(Boolean bool) {
    if (bool == null) {
        return null;
    }
    return (bool.booleanValue() ? Boolean.FALSE : Boolean.TRUE);
}

From source file:Main.java

/**
 * <p>Negates the specified boolean.</p>
 *
 * <p>If {@code null} is passed in, {@code null} will be returned.</p>
 *
 * <p>NOTE: This returns null and will throw a NullPointerException if autoboxed to a boolean. </p>
 *
 * <pre>/*from  w  w w  . ja v  a  2s  .co m*/
 *   BooleanUtils.negate(Boolean.TRUE)  = Boolean.FALSE;
 *   BooleanUtils.negate(Boolean.FALSE) = Boolean.TRUE;
 *   BooleanUtils.negate(null)          = null;
 * </pre>
 *
 * @param bool  the Boolean to negate, may be null
 * @return the negated Boolean, or {@code null} if {@code null} input
 */
public static Boolean negate(Boolean bool) {
    if (bool == null) {
        return null;
    }
    return bool.booleanValue() ? Boolean.FALSE : Boolean.TRUE;
}