Java Object Array Convert To convertObjectToBoolean(Object value)

Here you can find the source of convertObjectToBoolean(Object value)

Description

Throws an IllegalArgumentException if the provided value is null.

License

Open Source License

Declaration

public static boolean convertObjectToBoolean(Object value) throws IllegalArgumentException 

Method Source Code

//package com.java2s;

public class Main {
    /**//from ww w .j a  v  a 2 s.  co  m
     * Throws an IllegalArgumentException if the provided value is null.
     */
    public static boolean convertObjectToBoolean(Object value) throws IllegalArgumentException {
        if (value != null) {
            if (value instanceof Boolean) {
                return ((Boolean) value).booleanValue();
            } else {
                return Boolean.valueOf(value.toString()).booleanValue();
            }
        } else {
            throw new IllegalArgumentException("Property value was null so it couldn't be converted to a boolean.");
        }
    }
}

Related

  1. convertObject(final Object obj, final Class clazz)
  2. convertObjectArrayToByte(Object[] array)
  3. convertObjectGUIToByteString(byte[] objectGUID)
  4. convertObjectToBean(Object obj, Class clazz)
  5. convertObjectToInt(Object value)
  6. convertObjectToIntegerIfNecessary(final Object configValue)
  7. convertObjectToSqlSyntaxe(Object value)
  8. objectArrayToIntArray(Object[] objectArray)