java/sql-dk/src/info/globalcode/sql/dk/formatting/CommonProperties.java
branchv_0
changeset 212 d154d6012cbe
parent 206 e2f24eea8543
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/CommonProperties.java	Sat Aug 15 11:07:50 2015 +0200
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/CommonProperties.java	Sat Aug 15 11:52:38 2015 +0200
     1.3 @@ -17,12 +17,34 @@
     1.4   */
     1.5  package info.globalcode.sql.dk.formatting;
     1.6  
     1.7 +import java.util.Collections;
     1.8 +import java.util.HashMap;
     1.9 +import java.util.Map;
    1.10 +
    1.11  /**
    1.12   *
    1.13   * @author Ing. František Kučera (frantovo.cz)
    1.14   */
    1.15  public class CommonProperties {
    1.16  
    1.17 +	private static final Map<Class, String> TYPE_SIMPLE_NAMES;
    1.18 +
    1.19 +	static {
    1.20 +		Map<Class, String> m = new HashMap<>();
    1.21 +		m.put(Boolean.class, "boolean");
    1.22 +		m.put(String.class, "String");
    1.23 +		m.put(Character.class, "char");
    1.24 +		m.put(Integer.class, "int");
    1.25 +		m.put(Long.class, "long");
    1.26 +		m.put(Double.class, "double");
    1.27 +		TYPE_SIMPLE_NAMES = Collections.unmodifiableMap(m);
    1.28 +	}
    1.29 +
    1.30 +	public static String getSimpleTypeName(Class type) {
    1.31 +		String name = TYPE_SIMPLE_NAMES.get(type);
    1.32 +		return name == null ? type.getName() : name;
    1.33 +	}
    1.34 +
    1.35  	public static final String COLORFUL = "color";
    1.36 -	public static final String COLORFUL_DESCRIPTION = "whether the output should be printed in color (escape sequences)";
    1.37 +	public static final String COLORFUL_DESCRIPTION = "whether the output should be printed in color (ANSI Escape Sequences)";
    1.38  }