java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/CommonProperties.java
author František Kučera <franta-hg@frantovo.cz>
Thu, 24 Oct 2019 21:43:08 +0200
branchv_0
changeset 250 aae5009bd0af
parent 238 4a1864c3e867
permissions -rw-r--r--
fix license version: GNU GPLv3
franta-hg@206
     1
/**
franta-hg@206
     2
 * SQL-DK
franta-hg@206
     3
 * Copyright © 2015 František Kučera (frantovo.cz)
franta-hg@206
     4
 *
franta-hg@206
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@206
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@250
     7
 * the Free Software Foundation, version 3 of the License.
franta-hg@206
     8
 *
franta-hg@206
     9
 * This program is distributed in the hope that it will be useful,
franta-hg@206
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@206
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@206
    12
 * GNU General Public License for more details.
franta-hg@206
    13
 *
franta-hg@206
    14
 * You should have received a copy of the GNU General Public License
franta-hg@206
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@206
    16
 */
franta-hg@206
    17
package info.globalcode.sql.dk.formatting;
franta-hg@206
    18
franta-hg@212
    19
import java.util.Collections;
franta-hg@212
    20
import java.util.HashMap;
franta-hg@212
    21
import java.util.Map;
franta-hg@212
    22
franta-hg@206
    23
/**
franta-hg@206
    24
 *
franta-hg@206
    25
 * @author Ing. František Kučera (frantovo.cz)
franta-hg@206
    26
 */
franta-hg@206
    27
public class CommonProperties {
franta-hg@206
    28
franta-hg@212
    29
	private static final Map<Class, String> TYPE_SIMPLE_NAMES;
franta-hg@212
    30
franta-hg@212
    31
	static {
franta-hg@212
    32
		Map<Class, String> m = new HashMap<>();
franta-hg@212
    33
		m.put(Boolean.class, "boolean");
franta-hg@212
    34
		m.put(String.class, "String");
franta-hg@212
    35
		m.put(Character.class, "char");
franta-hg@212
    36
		m.put(Integer.class, "int");
franta-hg@212
    37
		m.put(Long.class, "long");
franta-hg@212
    38
		m.put(Double.class, "double");
franta-hg@212
    39
		TYPE_SIMPLE_NAMES = Collections.unmodifiableMap(m);
franta-hg@212
    40
	}
franta-hg@212
    41
franta-hg@212
    42
	public static String getSimpleTypeName(Class type) {
franta-hg@212
    43
		String name = TYPE_SIMPLE_NAMES.get(type);
franta-hg@212
    44
		return name == null ? type.getName() : name;
franta-hg@212
    45
	}
franta-hg@212
    46
franta-hg@206
    47
	public static final String COLORFUL = "color";
franta-hg@212
    48
	public static final String COLORFUL_DESCRIPTION = "whether the output should be printed in color (ANSI Escape Sequences)";
franta-hg@206
    49
}