mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-09 11:20:14 +00:00
java: add test programs for DynamicCodeGenPacker, Unpacker, Converter classes
This commit is contained in:
parent
732c8d7350
commit
92ddb37ed3
6 changed files with 1722 additions and 462 deletions
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue