if (Conversions.toBoolean(noCache1)) { if (responseHeadersMap.size() == 0) { responseHeadersMap = new MultiMapImpl<>();
/** * Converts the value to boolean. * * @param value value * @return value converted to boolean */ public static boolean toBoolean(Object value) { return toBoolean(value, false); }
/** * Converts the value to boolean. * * @param value value * @return value converted to boolean */ public static boolean toBoolean(Object value) { return toBoolean(value, false); }
@Override public final boolean getBoolean( Object obj ) { if ( obj instanceof Map ) { Map map = ( Map ) obj; return Conversions.toBoolean(map.get(name)); } return Exceptions.die(Boolean.class, "Object must be a map"); }
@Override public final boolean getBoolean( Object obj ) { if ( obj instanceof Map ) { Map map = ( Map ) obj; return Conversions.toBoolean(map.get(name)); } return Exceptions.die(Boolean.class, "Object must be a map"); }
public static boolean sysProp(String key, boolean defaultValue) { String property = (String) systemProperties.get(key); if (property == null) { property = env.get(key); } if (property == null) { String newKey = Str.underBarCase(key); property = env.get(newKey); } if (property == null) { return defaultValue; } return Conversions.toBoolean(property); }
public static boolean sysProp(String key, boolean defaultValue) { String property = (String) systemProperties.get(key); if (property == null) { property = env.get(key); } if (property == null) { String newKey = Str.underBarCase(key); property = env.get(newKey); } if (property == null) { return defaultValue; } return Conversions.toBoolean(property); }
public static int toInt(Object obj, int defaultValue) { if (obj.getClass() == int.class) { return int.class.cast(obj); } if (obj instanceof Number) { return ((Number) obj).intValue(); } else if (obj instanceof Boolean || obj.getClass() == Boolean.class) { boolean value = toBoolean(obj); return value ? 1 : 0; } else if (obj instanceof CharSequence) { try { return StringScanner.parseInt(Str.toString(obj)); } catch (Exception ex) { return defaultValue; } } return defaultValue; }
public static int toInt(Object obj, int defaultValue) { if (obj.getClass() == int.class) { return int.class.cast(obj); } if (obj instanceof Number) { return ((Number) obj).intValue(); } else if (obj instanceof Boolean || obj.getClass() == Boolean.class) { boolean value = toBoolean(obj); return value ? 1 : 0; } else if (obj instanceof CharSequence) { try { return StringScanner.parseInt(Str.toString(obj)); } catch (Exception ex) { return defaultValue; } } return defaultValue; }
public static char toChar(Object obj, final char defaultChar) { if (obj.getClass() == char.class) { return char.class.cast(obj); } else if (obj instanceof Character) { return ((Character) obj).charValue(); } else if (obj instanceof CharSequence) { return obj.toString().charAt(0); } else if (obj instanceof Number) { return (char) toInt(obj); } else if (obj instanceof Boolean || obj.getClass() == Boolean.class) { boolean value = toBoolean(obj); return value ? 'T' : 'F'; } else if (obj.getClass().isPrimitive()) { return (char) toInt(obj); } else { String str = toString(obj); if (str.length() > 0) { return str.charAt(0); } else { return defaultChar; } } }
public static char toChar(Object obj, final char defaultChar) { if (obj.getClass() == char.class) { return char.class.cast(obj); } else if (obj instanceof Character) { return ((Character) obj).charValue(); } else if (obj instanceof CharSequence) { return obj.toString().charAt(0); } else if (obj instanceof Number) { return (char) toInt(obj); } else if (obj instanceof Boolean || obj.getClass() == Boolean.class) { boolean value = toBoolean(obj); return value ? 'T' : 'F'; } else if (obj.getClass().isPrimitive()) { return (char) toInt(obj); } else { String str = toString(obj); if (str.length() > 0) { return str.charAt(0); } else { return defaultChar; } } }
public static boolean getPropertyBoolean( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toBoolean(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.bln ) { return field.getBoolean( object ); } else { return Conversions.toBoolean( field.getValue( object ) ); } }
public static boolean getPropertyBoolean( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toBoolean(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.bln ) { return field.getBoolean( object ); } else { return Conversions.toBoolean( field.getValue( object ) ); } }
return toBoolean(Conversions.toString(obj));
return toBoolean(Conversions.toString(obj));
return null; } else if (clz == Typ.bool || clz == Typ.bln) { Boolean b = toBoolean(value); return (T) b; } else if (Typ.isMap(clz)) {
return null; } else if (clz == Typ.bool || clz == Typ.bln) { Boolean b = toBoolean(value); return (T) b; } else if (Typ.isMap(clz)) {
if (Conversions.toBoolean(noCache1)) { if (responseHeadersMap.size()==0) { responseHeadersMap = new MultiMapImpl<>();
if (Conversions.toBoolean(noCache1)) { if (responseHeadersMap.size() == 0) { responseHeadersMap = new MultiMapImpl<>();
return (T) (Boolean) toBoolean(value);