Java Boolean From toBoolean(Object object)

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

Description

to Boolean

License

Apache License

Declaration

public static boolean toBoolean(Object object) 

Method Source Code

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

public class Main {
    public static boolean toBoolean(Object object) {
        if (object.equals(Boolean.TRUE)
                || (object instanceof String && (((String) object).equalsIgnoreCase("true"))
                        || ((String) object).equalsIgnoreCase("1"))
                || ((object instanceof Number) && (((Number) object).intValue() == 1))) {
            return true;
        }/* ww  w  .  j  a v a 2  s.c  o  m*/
        return false;
    }
}

Related

  1. toBoolean(Object obj)
  2. toBoolean(Object obj)
  3. toBoolean(Object object)
  4. toBoolean(Object object)
  5. toBoolean(Object object)
  6. toBoolean(Object object, Boolean defaultValue)
  7. toBoolean(Object property, boolean defaultValue)
  8. toBoolean(Object s)
  9. toBoolean(Object v)