mirror of
https://github.com/msgpack/msgpack-c
synced 2026-06-08 16:11:40 +00:00
java: add test programs for DynamicCodeGenPacker, Unpacker, Converter classes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user