mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-19 12:42:31 +02:00
java: fixes CollectionTemplate
This commit is contained in:
@@ -31,10 +31,11 @@ public class CollectionTemplate implements Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void pack(Packer pk, Object target) throws IOException {
|
public void pack(Packer pk, Object target) throws IOException {
|
||||||
if(target instanceof Collection) {
|
if(!(target instanceof Collection)) {
|
||||||
throw new MessageTypeException();
|
throw new MessageTypeException();
|
||||||
}
|
}
|
||||||
Collection<Object> collection = (Collection<Object>)target;
|
Collection<Object> collection = (Collection<Object>)target;
|
||||||
|
pk.packArray(collection.size());
|
||||||
for(Object element : collection) {
|
for(Object element : collection) {
|
||||||
elementTemplate.pack(pk, element);
|
elementTemplate.pack(pk, element);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user