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