java: loads template classes when Unpacker, MessagePackObject or ClassTemplate is loaded

This commit is contained in:
frsyuki
2010-09-27 17:42:00 +09:00
parent ee1ba5c0f2
commit 1c0afbc5c5
4 changed files with 9 additions and 4 deletions

View File

@@ -23,6 +23,10 @@ import java.util.Map;
import java.math.BigInteger;
public abstract class MessagePackObject implements Cloneable, MessagePackable {
static {
Templates.load();
}
public boolean isNil() {
return false;
}

View File

@@ -20,6 +20,8 @@ package org.msgpack;
import org.msgpack.template.*;
public class Templates {
public static void load() { }
public static Template tList(Template elementTemplate) {
return new ListTemplate(elementTemplate);
}

View File

@@ -103,6 +103,9 @@ import java.math.BigInteger;
* </pre>
*/
public class Unpacker implements Iterable<MessagePackObject> {
static {
Templates.load();
}
// buffer:
// +---------------------------------------------+

View File

@@ -18,8 +18,6 @@ public class TestReflectionPackerTemplate {
@Test
public void testPackConvert() throws Exception {
tString(); // FIXME link StringTemplate
ByteArrayOutputStream out = new ByteArrayOutputStream();
MessagePacker packer = ReflectionPacker.create(StringFieldClass.class);
@@ -45,8 +43,6 @@ public class TestReflectionPackerTemplate {
@Test
public void testPackConvert02() throws Exception {
tString(); // FIXME link StringTemplate
ByteArrayOutputStream out = new ByteArrayOutputStream();
CustomPacker.register(StringFieldClass.class, ReflectionPacker.create(StringFieldClass.class));