Package com.addthis.bundle.value

Examples of com.addthis.bundle.value.ValueMap


                    Bytes.writeLength(classID, out);
                }
                encodeValue(custom.asMap(), out, classIndex);
                break;
            case MAP:
                ValueMap map = val.asMap();
                out.write(TYPE.MAP.val);
                Bytes.writeLength(map.size(), out);
                for (ValueMapEntry e : map) {
                    encodeValue(ValueFactory.create(e.getKey()), out, classIndex);
                    encodeValue(e.getValue(), out, classIndex);
                }
                break;
View Full Code Here


                for (int i = 0; i < len; i++) {
                    arr.append(decodeValue(in, classMap));
                }
                return arr;
            case MAP:
                ValueMap map = ValueFactory.createMap();
                long count = Bytes.readLength(in);
                while (count-- > 0) {
                    ValueObject key = decodeValue(in, classMap);
                    ValueObject val = decodeValue(in, classMap);
                    map.put(key.toString(), val);
                }
                return map;
            case CUSTOM_INDEX:
                Class<? extends ValueObject> ci = classMap.getObject((int) Bytes.readLength(in));
                return rehydrate(ci, in, classMap);
View Full Code Here

    /** */
    private static ValueCustom rehydrate(Class<? extends ValueObject> cc, InputStream in, ClassIndexMap classMap) {
        try {
            ValueCustom vc = cc.newInstance().asCustom();
            ValueMap map = decodeValue(in, classMap).asMap();
            vc.setValues(map);
            return vc;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

                for (int i = 0; i < len; i++) {
                    arr.add(decodeValue(in, classMap));
                }
                return arr;
            case MAP:
                ValueMap map = ValueFactory.createMap();
                long count = Bytes.readLength(in);
                while (count-- > 0) {
                    ValueObject key = decodeValue(in, classMap);
                    ValueObject val = decodeValue(in, classMap);
                    map.put(key.toString(), val);
                }
                return map;
            case CUSTOM_INDEX:
                Class<? extends ValueObject> ci = classMap.getObject((int) Bytes.readLength(in));
                return rehydrate(ci, in, classMap);
View Full Code Here

    /** */
    private static ValueCustom rehydrate(Class<? extends ValueObject> cc, InputStream in, ClassIndexMap classMap) {
        try {
            ValueCustom vc = cc.newInstance().asCustom();
            ValueMap map = decodeValue(in, classMap).asMap();
            vc.setValues(map);
            return vc;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

                }
            }
            builder.append(']');
            return builder.toString();
        } else if (valueObject instanceof ValueMap) {
            ValueMap asMap = (ValueMap) valueObject;
            StringBuilder builder = new StringBuilder();
            builder.append('{');
            Iterator<ValueMapEntry> iterator = asMap.iterator();
            while (iterator.hasNext()) {
                ValueMapEntry<?> entry = iterator.next();
                builder.append('"');
                builder.append(entry.getKey());
                builder.append("\" : ");
View Full Code Here

                }
            }
            builder.append(']');
            return builder.toString();
        } else if (valueObject instanceof ValueMap) {
            ValueMap asMap = (ValueMap) valueObject;
            StringBuilder builder = new StringBuilder();
            builder.append('{');
            Iterator<ValueMapEntry> iterator = asMap.iterator();
            while (iterator.hasNext()) {
                ValueMapEntry entry = iterator.next();
                builder.append('"');
                builder.append(entry.getKey());
                builder.append("\" : ");
View Full Code Here

                    Bytes.writeLength(classID, out);
                }
                encodeValue(custom.asMap(), out, classIndex);
                break;
            case MAP:
                ValueMap map = val.asMap();
                out.write(TYPE.MAP.val);
                Bytes.writeLength(map.size(), out);
                for (ValueMapEntry e : map) {
                    encodeValue(ValueFactory.create(e.getKey()), out, classIndex);
                    encodeValue(e.getValue(), out, classIndex);
                }
                break;
View Full Code Here

                for (int i = 0; i < len; i++) {
                    arr.add(decodeValue(in, classMap));
                }
                return arr;
            case MAP:
                ValueMap map = ValueFactory.createMap();
                long count = Bytes.readLength(in);
                while (count-- > 0) {
                    ValueObject key = decodeValue(in, classMap);
                    ValueObject val = decodeValue(in, classMap);
                    map.put(key.toString(), val);
                }
                return map;
            case CUSTOM_INDEX:
                Class<? extends ValueObject> ci = classMap.getObject((int) Bytes.readLength(in));
                return rehydrate(ci, in, classMap);
View Full Code Here

    /** */
    private static ValueCustom rehydrate(Class<? extends ValueObject> cc, InputStream in, ClassIndexMap classMap) {
        try {
            ValueCustom vc = cc.newInstance().asCustom();
            ValueMap map = decodeValue(in, classMap).asMap();
            vc.setValues(map);
            return vc;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

TOP

Related Classes of com.addthis.bundle.value.ValueMap

Copyright © 2018 www.massapicom. 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.