mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-07 10:19:51 +00:00
java: adds MessagePackObject.unpack(Class<T> klass)
This commit is contained in:
parent
d08d3bf56d
commit
95f01a5976
1 changed files with 7 additions and 0 deletions
|
|
@ -21,6 +21,8 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.math.BigInteger;
|
||||
import org.msgpack.template.ClassTemplate;
|
||||
import org.msgpack.template.NullableTemplate;
|
||||
|
||||
public abstract class MessagePackObject implements Cloneable, MessagePackable {
|
||||
static {
|
||||
|
|
@ -140,5 +142,10 @@ public abstract class MessagePackObject implements Cloneable, MessagePackable {
|
|||
public Object convert(Template tmpl) throws MessageTypeException {
|
||||
return tmpl.convert(this);
|
||||
}
|
||||
|
||||
public <T> T convert(Class<T> klass) throws MessageTypeException {
|
||||
// FIXME nullable?
|
||||
return (T)convert(new NullableTemplate(new ClassTemplate(klass)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue