mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-21 07:45:02 +02:00
java: loads template classes when Unpacker, MessagePackObject or ClassTemplate is loaded
This commit is contained in:
@@ -23,6 +23,10 @@ import java.util.Map;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
public abstract class MessagePackObject implements Cloneable, MessagePackable {
|
public abstract class MessagePackObject implements Cloneable, MessagePackable {
|
||||||
|
static {
|
||||||
|
Templates.load();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNil() {
|
public boolean isNil() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,8 @@ package org.msgpack;
|
|||||||
import org.msgpack.template.*;
|
import org.msgpack.template.*;
|
||||||
|
|
||||||
public class Templates {
|
public class Templates {
|
||||||
|
public static void load() { }
|
||||||
|
|
||||||
public static Template tList(Template elementTemplate) {
|
public static Template tList(Template elementTemplate) {
|
||||||
return new ListTemplate(elementTemplate);
|
return new ListTemplate(elementTemplate);
|
||||||
}
|
}
|
||||||
|
@@ -103,6 +103,9 @@ import java.math.BigInteger;
|
|||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public class Unpacker implements Iterable<MessagePackObject> {
|
public class Unpacker implements Iterable<MessagePackObject> {
|
||||||
|
static {
|
||||||
|
Templates.load();
|
||||||
|
}
|
||||||
|
|
||||||
// buffer:
|
// buffer:
|
||||||
// +---------------------------------------------+
|
// +---------------------------------------------+
|
||||||
|
@@ -18,8 +18,6 @@ public class TestReflectionPackerTemplate {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPackConvert() throws Exception {
|
public void testPackConvert() throws Exception {
|
||||||
tString(); // FIXME link StringTemplate
|
|
||||||
|
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
|
||||||
MessagePacker packer = ReflectionPacker.create(StringFieldClass.class);
|
MessagePacker packer = ReflectionPacker.create(StringFieldClass.class);
|
||||||
@@ -45,8 +43,6 @@ public class TestReflectionPackerTemplate {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPackConvert02() throws Exception {
|
public void testPackConvert02() throws Exception {
|
||||||
tString(); // FIXME link StringTemplate
|
|
||||||
|
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
|
||||||
CustomPacker.register(StringFieldClass.class, ReflectionPacker.create(StringFieldClass.class));
|
CustomPacker.register(StringFieldClass.class, ReflectionPacker.create(StringFieldClass.class));
|
||||||
|
Reference in New Issue
Block a user