forked from msgpack/msgpack-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotNullableTemplate.java
More file actions
36 lines (26 loc) · 818 Bytes
/
NotNullableTemplate.java
File metadata and controls
36 lines (26 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.msgpack.template;
import java.io.IOException;
import org.msgpack.packer.Packer;
import org.msgpack.unpacker.Unpacker;
public class NotNullableTemplate<T> extends AbstractTemplate<T> {
private Template<T> tmpl;
public NotNullableTemplate(Template<T> elementTemplate) {
tmpl = elementTemplate;
}
@Override
public void write(Packer pk, T v, boolean required) throws IOException {
tmpl.write(pk, v, required);
}
@Override
public void write(Packer pk, T v) throws IOException {
write(pk, v, true);
}
@Override
public T read(Unpacker u, T to, boolean required) throws IOException {
return tmpl.read(u, to, required);
}
@Override
public T read(Unpacker u, T to) throws IOException {
return read(u, to, true);
}
}