Skip to content

Commit 50d7709

Browse files
author
choplin
committed
overload convert method with Template parameter
convert method with Template is required when you convert Value to parametric type. e.g. `readAsValue(writeV((1,2,))).as[(Int,Int)]` doesn't work with msgpack-scala
1 parent 95978d7 commit 50d7709

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/org/msgpack/MessagePack.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,19 @@ public <T> T convert(Value v, Class<T> c) throws IOException {
556556
Template<T> tmpl = registry.lookup(c);
557557
return tmpl.read(new Converter(this, v), null);
558558
}
559+
560+
/**
561+
* Converts {@link org.msgpack.type.Value} object to object according to template
562+
*
563+
* @since 0.6.8
564+
* @param v
565+
* @param tmpl
566+
* @return
567+
* @throws IOException
568+
*/
569+
public <T> T convert(Value v, Template<T> tmpl) throws IOException {
570+
return tmpl.read(new Converter(this, v), null);
571+
}
559572

560573
/**
561574
* Unconverts specified object to {@link org.msgpack.type.Value} object.

0 commit comments

Comments
 (0)