Returns a field in a Json object as a boolean.

@param object the Json Object
@param field the field in the Json object to return
@param defaultValue a default value for the field if the field value is null
@return the Json field value as a boolean
427192
public static boolean getBoolean(JsonObject object, String field, boolean defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null || value.isNull()) {
            return defaultValue;
        } else {
            return value.asBoolean();
        }
    }
927052
static boolean valueAsBoolean(Map<String, Object> map, Key key, boolean defaultValue) {
        return Boolean.parseBoolean(valueAsString(map, key, String.valueOf(defaultValue)));
    }
693716
public boolean getBoolean(String key, boolean defaultValue) {
    String value = get(key);
    // We can't use `Boolean.parseBoolean` here, as it returns false for invalid strings.
    if (value == null) {
      return defaultValue;
    } else if (value.equalsIgnoreCase("true")) {
      return true;
    } else if (value.equalsIgnoreCase("false")) {
      return false;
    } else {
      throw new IllegalArgumentException(value + " is not a boolean string.");
    }
  }
474008
public static Boolean readBoolean(String value, Boolean defaultValue) {
		if (!StringUtils.hasText(value)) return defaultValue;
		
		return Boolean.valueOf(value);
	}
107658
public static JsonArray getArray(JsonObject object, String field) {
        final JsonValue value = object.get(field);
        throwExceptionIfNull(value, field);
        return value.asArray();
    }
946059
public static long getLong(JsonObject object, String field, long defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null || value.isNull()) {
            return defaultValue;
        } else {
            return value.asLong();
        }
    }
561182
public boolean getBoolean(String key, boolean defaultValue) {
		Object o = getObject(key);
		if (o == null) {
			return defaultValue;
		}
		boolean b = defaultValue;
		try {
			b = Boolean.parseBoolean(o.toString());
		}
		catch (Exception e) {
			throw new IllegalArgumentException("Object ["+o+"] associated with key ["+key+"] is not of type Boolean.");
		}
		return b;
	}
316818
public static Boolean parseGeneralString(String str, Boolean defaultValue) {
		return BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(str), defaultValue);
	}
83365
private static boolean toBeIgnoredByJackson(Class<?> clazz, String field) {

		Annotation[] annotations = AnnotationUtils.getAnnotations(clazz);

		return annotations == null //
				? false //
				: Arrays.stream(annotations) //
						.filter(annotation -> annotation.annotationType().equals(JsonIgnoreProperties.class)) //
						.map(annotation -> (String[]) AnnotationUtils.getAnnotationAttributes(annotation).get("value")) //
						.flatMap(Arrays::stream) //
						.anyMatch(propertyName -> propertyName.equalsIgnoreCase(field));
	}
755808
private boolean getBooleanValue(final Value value, final boolean defaultValue) {

		if (value != null && value instanceof BooleanValue) {

			return ((BooleanValue)value).isValue();
		}

		return defaultValue;
	}
637479
boolean getBooleanProperty(String name, boolean defaultValue) {
        String val = getProperty(name);
        if (val == null) {
            return defaultValue;
        }
        val = val.toLowerCase();
        if (val.equals("true") || val.equals("1")) {
            return true;
        } else if (val.equals("false") || val.equals("0")) {
            return false;
        }
        return defaultValue;
    }
954076
public static Object getValue(Field field, Object object) {
		String fieldName = field.getName();
		String setMethodName = "get" + firstLetterUpperCase(fieldName);
		Method method = null;
		try {
			method = object.getClass().getMethod(setMethodName);
		} catch (Exception e) {
		}
		
		if(method != null) {
			try {
				return method.invoke(object);
			} catch (Exception e) {
				LOGGER.error("method invoke", e);
			}
		}
		
		field.setAccessible(true);
		try {
			return field.get(object);
		} catch (Exception e) {
			LOGGER.error("method invoke", e);
			return null;
		}
	}
686770
public static boolean getBoolean(Properties config, String key, boolean defaultValue) {
		String val = config.getProperty(key);
		if (val == null) {
			return defaultValue;
		} else {
			return Boolean.parseBoolean(val);
		}
	}
625040
public static int getInt(JsonObject object, String field, int defaultValue) {
        final JsonValue value = object.get(field);
        if (value == null || value.isNull()) {
            return defaultValue;
        } else {
            return value.asInt();
        }
    }
110294
public boolean toBoolean(String str, boolean defaultValue) {

		if (StringUtils.equalsIgnoreCase(null, str)) {
			return defaultValue;
		} else if (StringUtils.equalsIgnoreCase("true", str)) {
			return true;
		} else if (StringUtils.equalsIgnoreCase("false", str)) {
			return false;
		} else if (StringUtils.equalsIgnoreCase("1", str)) {
			return true;
		} else if (StringUtils.equalsIgnoreCase("0", str)) {
			return false;
		} else {
			return defaultValue;
		}

	}
1298415
public synchronized boolean getAttribute(String key, boolean defaultValue)
	{
		if(attributes.containsKey(key))
		{
			Object obj = attributes.get(key);
			if(obj instanceof Boolean)
			{
				return (Boolean) obj;
			}
		}
		return defaultValue;
	}
1346171
public boolean getBoolean(String key, boolean defaultResponse) {
        Boolean b = (Boolean) get(key);
        if (b != null) {
            return b.booleanValue();
        }
        return defaultResponse;
    }