View Javadoc

1   package org.helyx.basics4me.lang;
2   
3   public class BooleanUtil {
4   
5   	public static final String TRUE = "true";
6   	public static final String FALSE = "false";
7   
8   	private BooleanUtil() {
9   		super();
10  	}
11  	
12  	public static boolean getBoolean(String value) {
13  		return parseBooleanIgnoreCase(value);
14  	}
15  	
16  	public static boolean parseBoolean(String value) {
17  		return TRUE.equals(value);
18  	}
19  	
20  	public static boolean parseBooleanIgnoreCase(String value) {
21  		if (value == null) {
22  			return false;
23  		}
24  		return TRUE.equals(value.toLowerCase());
25  	}
26  
27  	public static String valueOf(boolean booleanValue) {
28  		return booleanValue ? TRUE : FALSE;
29  	}
30  
31  }