Java Boolean From toBoolean(Object value)

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

Description

to Boolean

License

Apache License

Declaration

public static boolean toBoolean(Object value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static boolean toBoolean(Object value) {
        if ((value == null || value instanceof Number && (((Number) value).longValue()) == 0L
                || value instanceof String && (value.equals("") || ((String) value).equalsIgnoreCase("false")
                        || ((String) value).equalsIgnoreCase("no") || ((String) value).equalsIgnoreCase("0"))
                || value instanceof Boolean && value.equals(false))) {
            return false;
        }/*  www .  j  ava 2 s  .com*/
        return true;
    }
}

Related

  1. toBoolean(Object value)
  2. toBoolean(Object value)
  3. toBoolean(Object value)
  4. toBoolean(Object value)
  5. toBoolean(Object value)
  6. toBoolean(Object value, Boolean defaultValue)
  7. toBoolean(Object value, boolean defaultValue)
  8. toBoolean(String baseString)
  9. toBoolean(String content)