0
|
1 //
|
|
2 // MessagePack for Java
|
|
3 //
|
|
4 // Copyright (C) 2009 - 2013 FURUHASHI Sadayuki
|
|
5 //
|
|
6 // Licensed under the Apache License, Version 2.0 (the "License");
|
|
7 // you may not use this file except in compliance with the License.
|
|
8 // You may obtain a copy of the License at
|
|
9 //
|
|
10 // http://www.apache.org/licenses/LICENSE-2.0
|
|
11 //
|
|
12 // Unless required by applicable law or agreed to in writing, software
|
|
13 // distributed under the License is distributed on an "AS IS" BASIS,
|
|
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15 // See the License for the specific language governing permissions and
|
|
16 // limitations under the License.
|
|
17 //
|
|
18 package org.msgpack.template;
|
|
19
|
|
20 import java.nio.ByteBuffer;
|
|
21 import java.util.List;
|
|
22 import java.util.Map;
|
|
23 import java.util.Collection;
|
|
24 import java.util.Date;
|
|
25 import java.math.BigInteger;
|
|
26 import java.math.BigDecimal;
|
|
27 import org.msgpack.type.Value;
|
|
28
|
|
29 @SuppressWarnings({ "rawtypes", "unchecked" })
|
|
30 public final class Templates {
|
|
31 public static final Template<Value> TValue = ValueTemplate.getInstance();
|
|
32
|
|
33 public static final Template<Byte> TByte = ByteTemplate.getInstance();
|
|
34
|
|
35 public static final Template<Short> TShort = ShortTemplate.getInstance();
|
|
36
|
|
37 public static final Template<Integer> TInteger = IntegerTemplate.getInstance();
|
|
38
|
|
39 public static final Template<Long> TLong = LongTemplate.getInstance();
|
|
40
|
|
41 public static final Template<Character> TCharacter = CharacterTemplate.getInstance();
|
|
42
|
|
43 public static final Template<BigInteger> TBigInteger = BigIntegerTemplate.getInstance();
|
|
44
|
|
45 public static final Template<BigDecimal> TBigDecimal = BigDecimalTemplate.getInstance();
|
|
46
|
|
47 public static final Template<Float> TFloat = FloatTemplate.getInstance();
|
|
48
|
|
49 public static final Template<Double> TDouble = DoubleTemplate.getInstance();
|
|
50
|
|
51 public static final Template<Boolean> TBoolean = BooleanTemplate.getInstance();
|
|
52
|
|
53 public static final Template<String> TString = StringTemplate.getInstance();
|
|
54
|
|
55 public static final Template<byte[]> TByteArray = ByteArrayTemplate.getInstance();
|
|
56
|
|
57 public static final Template<ByteBuffer> TByteBuffer = ByteBufferTemplate.getInstance();
|
|
58
|
|
59 public static final Template<Date> TDate = DateTemplate.getInstance();
|
|
60
|
|
61 public static <T> Template<T> tNotNullable(Template<T> innerTemplate) {
|
|
62 return new NotNullableTemplate(innerTemplate);
|
|
63 }
|
|
64
|
|
65 public static <E> Template<List<E>> tList(Template<E> elementTemplate) {
|
|
66 return new ListTemplate(elementTemplate);
|
|
67 }
|
|
68
|
|
69 public static <K, V> Template<Map<K, V>> tMap(Template<K> keyTemplate, Template<V> valueTemplate) {
|
|
70 return new MapTemplate(keyTemplate, valueTemplate);
|
|
71 }
|
|
72
|
|
73 public static <E> Template<Collection<E>> tCollection(Template<E> elementTemplate) {
|
|
74 return new CollectionTemplate(elementTemplate);
|
|
75 }
|
|
76
|
|
77 public static <E extends Enum> Template<E> tOrdinalEnum(Class<E> enumClass) {
|
|
78 return new OrdinalEnumTemplate(enumClass);
|
|
79 }
|
|
80
|
|
81 // public static Template<T> tClass(Class<T> target) {
|
|
82 // // TODO
|
|
83 // }
|
|
84
|
|
85 @Deprecated
|
|
86 public static Template tByte() {
|
|
87 return TByte;
|
|
88 }
|
|
89
|
|
90 @Deprecated
|
|
91 public static Template tShort() {
|
|
92 return TShort;
|
|
93 }
|
|
94
|
|
95 @Deprecated
|
|
96 public static Template tInteger() {
|
|
97 return TInteger;
|
|
98 }
|
|
99
|
|
100 @Deprecated
|
|
101 public static Template tLong() {
|
|
102 return TLong;
|
|
103 }
|
|
104
|
|
105 @Deprecated
|
|
106 public static Template tCharacter() {
|
|
107 return TCharacter;
|
|
108 }
|
|
109
|
|
110 @Deprecated
|
|
111 public static Template tBigInteger() {
|
|
112 return TBigInteger;
|
|
113 }
|
|
114
|
|
115 @Deprecated
|
|
116 public static Template tBigDecimal() {
|
|
117 return TBigDecimal;
|
|
118 }
|
|
119
|
|
120 @Deprecated
|
|
121 public static Template tFloat() {
|
|
122 return TFloat;
|
|
123 }
|
|
124
|
|
125 @Deprecated
|
|
126 public static Template tDouble() {
|
|
127 return TDouble;
|
|
128 }
|
|
129
|
|
130 @Deprecated
|
|
131 public static Template tBoolean() {
|
|
132 return TBoolean;
|
|
133 }
|
|
134
|
|
135 @Deprecated
|
|
136 public static Template tString() {
|
|
137 return TString;
|
|
138 }
|
|
139
|
|
140 @Deprecated
|
|
141 public static Template tByteArray() {
|
|
142 return TByteArray;
|
|
143 }
|
|
144
|
|
145 @Deprecated
|
|
146 public static Template tByteBuffer() {
|
|
147 return TByteBuffer;
|
|
148 }
|
|
149
|
|
150 @Deprecated
|
|
151 public static Template tDate() {
|
|
152 return TDate;
|
|
153 }
|
|
154 }
|