mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-12-29 22:17:54 +01:00
import MessagePack for Java implementation plan 2
This commit is contained in:
18
java-plan2/test/Generate.java
Normal file
18
java-plan2/test/Generate.java
Normal file
@@ -0,0 +1,18 @@
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import org.msgpack.*;
|
||||
import org.msgpack.schema.*;
|
||||
|
||||
public class Generate {
|
||||
public static void main(String[] args) throws IOException
|
||||
{
|
||||
Writer output = new OutputStreamWriter(System.out);
|
||||
|
||||
Schema s1 = Schema.parse("(class Test (field uri raw) (field width int))");
|
||||
ClassGenerator.write(s1, output);
|
||||
|
||||
Schema s1 = Schema.parse("(class MediaContent (package serializers.msgpack) (field image (array (class Image (field uri string) (field title string) (field width int) (field height int) (field size int)))) (field media (class Media (field uri string) (field title string) (field width int) (field height int) (field format string) (field duration long) (field size long) (field bitrate int) (field person (array string)) (field player int) (field copyright string))))");
|
||||
ClassGenerator.write(s2, output);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user