Java Object to Boolean castBoolean(Object o)

Here you can find the source of castBoolean(Object o)

Description

cast Boolean

License

Open Source License

Declaration

public static Boolean castBoolean(Object o) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static Boolean castBoolean(Object o) {
        if (o instanceof Boolean) {
            return (Boolean) o;
        } else if (o instanceof String) {
            try {
                return Boolean.parseBoolean((String) o);
            } catch (IllegalArgumentException e) {
                return null;
            }/* www  .j  av  a 2s  . c o m*/
        }

        return null;
    }
}

Related

  1. asBoolean(Object object)
  2. asBoolean(Object value)
  3. asBoolean(Object value)
  4. asBoolean(Object value)
  5. castBoolean(Object inObject)
  6. castBoolean(Object o)
  7. castBoolean(Object o, boolean defaultValue)
  8. castBoolean(Object obj)
  9. castToBoolean(Object value)