java: add test programs for DynamicCodeGenPacker, Unpacker, Converter classes

This commit is contained in:
Muga Nishizawa 2010-09-28 22:51:38 +09:00
parent 732c8d7350
commit 92ddb37ed3
6 changed files with 1722 additions and 462 deletions

View file

@ -5,5 +5,7 @@ public interface Constants extends BasicConstants {
String POSTFIX_TYPE_NAME_UNPACKER = "_$$_Unpacker";
String POSTFIX_TYPE_NAME_CONVERTER = "_$$_Converter";
String POSTFIX_TYPE_NAME_TEMPLATE = "_$$_Template";
}

View file

@ -0,0 +1,17 @@
package org.msgpack.util.codegen;
import org.msgpack.MessageConverter;
public class DynamicCodeGenConverter {
public static MessageConverter create(Class<?> c) {
try {
DynamicCodeGen gen = DynamicCodeGen.getInstance();
Class<?> unpackerClass = gen.generateMessageConverterClass(c);
return (MessageConverter) unpackerClass.newInstance();
} catch (InstantiationException e) {
throw new DynamicCodeGenException(e.getMessage(), e);
} catch (IllegalAccessException e) {
throw new DynamicCodeGenException(e.getMessage(), e);
}
}
}