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 instanceof Boolean) {
            return (Boolean) value;
        }/*from   w  w  w . j a  va  2  s . co  m*/
        if (value instanceof String) {
            return "true".equalsIgnoreCase(value.toString()) ? Boolean.TRUE : Boolean.FALSE;
        }
        if (value instanceof Integer) {
            return (Integer) value > 0 ? Boolean.TRUE : Boolean.FALSE;
        }
        return null;
    }
}

Related

  1. toBoolean(Object property, boolean defaultValue)
  2. toBoolean(Object s)
  3. toBoolean(Object v)
  4. toBoolean(Object val)
  5. toBoolean(Object val, boolean defValue)
  6. toBoolean(Object value)
  7. toBoolean(Object value)
  8. toBoolean(Object value)
  9. toBoolean(Object value)