Examples of MapValue


Examples of org.msgpack.type.MapValue

    public int readMapBegin() {
        Value v = getTop();
        if(!v.isMap()) {
            throw new MessageTypeException("Expected map but got not map value");
        }
        MapValue m = v.asMapValue();
        stack.reduceCount();
        stack.pushMap(m.size());
        values[stack.getDepth()] = m.getKeyValueArray();
        return m.size();
    }
View Full Code Here

Examples of org.msgpack.type.MapValue

                stack.reduceCount();
                stack.pushArray(a.size());
                values[stack.getDepth()] = a.getElementArray();

            } else if(v.isMap()) {
                MapValue m = v.asMapValue();
                uc.writeMapBegin(m.size());
                stack.reduceCount();
                stack.pushMap(m.size());
                values[stack.getDepth()] = m.getKeyValueArray();

            } else {
                uc.write(v);
                stack.reduceCount();
            }
View Full Code Here

Examples of org.msgpack.type.MapValue

                stack.reduceCount();
                stack.pushArray(a.size());
                values[stack.getDepth()] = a.getElementArray();

            } else if(v.isMap()) {
                MapValue m = v.asMapValue();
                stack.reduceCount();
                stack.pushMap(m.size());
                values[stack.getDepth()] = m.getKeyValueArray();

            } else {
                stack.reduceCount();
            }
        }
View Full Code Here

Examples of org.msgpack.type.MapValue

    return sparsePacker.getResult();
  }

  protected void recursiveWrite(Value value) throws IOException {
    if (value.isMapValue()) {
      MapValue map = value.asMapValue();
      int newLength = 0;
      for (Map.Entry<Value, Value> entry : map.entrySet()) {
        if (!entry.getValue().isNilValue()) {
          ++newLength;
        }
      }
      sparsePacker.writeMapBegin(newLength);
      for (Map.Entry<Value, Value> entry : map.entrySet()) {
        if (!entry.getValue().isNilValue()) {
          sparsePacker.write(entry.getKey());
          recursiveWrite(entry.getValue());
        }
      }
View Full Code Here

Examples of org.msgpack.type.MapValue

        Assert.assertTrue(unpackedMap.containsKey("y"));
        Assert.assertTrue(unpackedMap.containsKey("z"));
        Assert.assertEquals("x", unpackedMap.get("x").asRawValue().getString());
        Assert.assertEquals("some", unpackedMap.get("y").asRawValue().getString());

        MapValue mapValue = unpackedMap.get("z").asMapValue();
        Map innerMapValue = new Converter(mapValue).read(tMap(TString, TString));
        Assert.assertNotNull(innerMapValue);
        Assert.assertEquals("b", innerMapValue.get("a"));
    }
View Full Code Here

Examples of org.msgpack.type.MapValue

                final Object val = deserializeObject(src.get(i));
                dst.add(i, val);
            }
            o = dst;
        } else if (v.isMapValue()) {
            final MapValue src = v.asMapValue();
            final HashMap<Object, Object> dst = new HashMap<Object, Object>(src.size());
            for (Map.Entry<Value, Value> entry : src.entrySet()) {
                final Object key = deserializeObject(entry.getKey());
                final Object val = deserializeObject(entry.getValue());
                dst.put(key, val);
            }
            o = dst;
View Full Code Here

Examples of rocket.beans.rebind.map.MapValue

    tag.setElement(element);

    final PlaceHolderResolver placeHolderResolver = this.getPlaceHolderResolver();
    tag.setPlaceHolderResolver(placeHolderResolver);

    final MapValue map = new MapValue();
    map.setFilename(this.getFilename());
    map.setGeneratorContext(this.getGenerator().getGeneratorContext());

    final NodeList entriesNodeList = element.getChildNodes();
    final int count = entriesNodeList.getLength();
    for (int i = 0; i < count; i++) {
      final Node node = entriesNodeList.item(i);
      if (node.getNodeType() != Node.ELEMENT_NODE) {
        continue;
      }

      final Element entryElement = (Element) node;
      final MapEntryTag entry = new MapEntryTag();
      entry.setElement(entryElement);
      entry.setPlaceHolderResolver(placeHolderResolver);

      final String key = entry.getKey();
      final Element valueElement = entry.getValue();
      final Value value = this.visitConstructorOrPropertyValue(valueElement);

      map.addEntry(key, value);
    }

    return map;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.