Java Boolean Value From booleanValue(Boolean value)

Here you can find the source of booleanValue(Boolean value)

Description

Return the boolean value.

License

Open Source License

Parameter

Parameter Description
value a parameter

Declaration

public static boolean booleanValue(Boolean value) 

Method Source Code

//package com.java2s;
/*// www. j a  v a2  s .  c  o m
 * Copyright 2012 The Solmix Project
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.gnu.org/licenses/ 
 * or see the FSF site: http://www.fsf.org. 
 */

public class Main {
    /**
     * Return the boolean value. if value is null return false.
     * 
     * @param value
     * @return
     */
    public static boolean booleanValue(Boolean value) {
        if (value == null)
            return false;
        else
            return value.booleanValue();
    }

    /**
     * If not equal return true.else return false. used {@link #isNotEqual(Object, Object)}
     * 
     * @param <T>
     * @param actual
     * @param expect
     * @return
     */
    public static boolean booleanValue(String booleanValue) {
        if ("true".equalsIgnoreCase(booleanValue))
            return true;
        else
            return false;
    }
}

Related

  1. booleanValue(Boolean b, boolean def)
  2. booleanValue(final Boolean booleanValue)
  3. booleanValue(Object arg)
  4. booleanValue(Object associationValue)
  5. booleanValue(Object obj, boolean defaultValue)