blob: 15b7e729446a0498e35d5438a3e48da25a008a6d (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
package org.msgpack.schema;
import java.io.IOException;
import org.msgpack.impl.*;
import org.msgpack.Packer;
import org.msgpack.GenericObject;
public abstract class Schema {
private String expression;
private String name;
public Schema(String name)
{
this.expression = expression;
this.name = name;
}
public String getName()
{
return name;
}
public String getFullName()
{
return name;
}
public String getExpression()
{
return name;
}
public static Schema parse(String source)
{
return SSchemaParser.parse(source);
}
public static Schema load(String source)
{
return SSchemaParser.load(source);
}
public abstract void pack(Packer pk, Object obj) throws IOException;
public abstract Object convert(GenericObject obj);
//public abstract Object convertGeneric(GenericObject obj);
public Object createNil()
{
return null;
}
public Object createBoolean(boolean v)
{
throw new RuntimeException("type error");
}
public Object createByte(byte v)
{
throw new RuntimeException("type error");
}
public Object createShort(short v)
{
throw new RuntimeException("type error");
}
public Object createInt(int v)
{
throw new RuntimeException("type error");
}
public Object createLong(long v)
{
throw new RuntimeException("type error");
}
public Object createFloat(float v)
{
throw new RuntimeException("type error");
}
public Object createDouble(double v)
{
throw new RuntimeException("type error");
}
public Object createRaw(byte[] b, int offset, int length)
{
throw new RuntimeException("type error");
}
}
|