MCPcopy Create free account
hub / github.com/jankotek/mapdb / SerializerUtils

Class SerializerUtils

src/main/java/org/mapdb/serializer/SerializerUtils.java:17–65  ·  view source on GitHub ↗

Created by jan on 2/28/16.

Source from the content-addressed store, hash-verified

15 * Created by jan on 2/28/16.
16 */
17public final class SerializerUtils {
18
19 private static Map<Class, Serializer> SERIALIZER_FOR_CLASS = new HashMap();
20
21 static {
22 SERIALIZER_FOR_CLASS.put(char.class, CHAR);
23 SERIALIZER_FOR_CLASS.put(Character.class, CHAR);
24 SERIALIZER_FOR_CLASS.put(String.class, STRING);
25 SERIALIZER_FOR_CLASS.put(long.class, LONG);
26 SERIALIZER_FOR_CLASS.put(Long.class, LONG);
27 SERIALIZER_FOR_CLASS.put(int.class, INTEGER);
28 SERIALIZER_FOR_CLASS.put(Integer.class, INTEGER);
29 SERIALIZER_FOR_CLASS.put(boolean.class, BOOLEAN);
30 SERIALIZER_FOR_CLASS.put(Boolean.class, BOOLEAN);
31 SERIALIZER_FOR_CLASS.put(byte[].class, BYTE_ARRAY);
32 SERIALIZER_FOR_CLASS.put(char[].class, CHAR_ARRAY);
33 SERIALIZER_FOR_CLASS.put(int[].class, INT_ARRAY);
34 SERIALIZER_FOR_CLASS.put(long[].class, LONG_ARRAY);
35 SERIALIZER_FOR_CLASS.put(double[].class, DOUBLE_ARRAY);
36 SERIALIZER_FOR_CLASS.put(UUID.class, UUID);
37 SERIALIZER_FOR_CLASS.put(byte.class, BYTE);
38 SERIALIZER_FOR_CLASS.put(Byte.class, BYTE);
39 SERIALIZER_FOR_CLASS.put(float.class, FLOAT);
40 SERIALIZER_FOR_CLASS.put(Float.class, FLOAT);
41 SERIALIZER_FOR_CLASS.put(double.class, DOUBLE);
42 SERIALIZER_FOR_CLASS.put(Double.class, DOUBLE);
43 SERIALIZER_FOR_CLASS.put(short.class, SHORT);
44 SERIALIZER_FOR_CLASS.put(Short.class, SHORT);
45 SERIALIZER_FOR_CLASS.put(short[].class, SHORT_ARRAY);
46 SERIALIZER_FOR_CLASS.put(float[].class, FLOAT_ARRAY);
47 SERIALIZER_FOR_CLASS.put(BigDecimal.class, BIG_DECIMAL);
48 SERIALIZER_FOR_CLASS.put(BigInteger.class, BIG_INTEGER);
49 SERIALIZER_FOR_CLASS.put(Class.class, CLASS);
50 SERIALIZER_FOR_CLASS.put(Date.class, DATE);
51
52 }
53
54
55 public static <R> Serializer<R> serializerForClass(Class<R> clazz){
56 return SERIALIZER_FOR_CLASS.get(clazz);
57 }
58
59 public static int compareInt(int x, int y) {
60 return (x < y) ? -1 : ((x == y) ? 0 : 1);
61 }
62
63
64
65}

Callers

nothing calls this directly

Calls 1

putMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…