Package com.addthis.bundle.value

Examples of com.addthis.bundle.value.ValueCustom


            return;
        }
        ValueObject.TYPE objectType = val.getObjectType();
        switch (objectType) {
            case CUSTOM:
                ValueCustom custom = val.asCustom();
                Class<? extends ValueObject> type = custom.getContainerClass();
                Integer classID = classIndex.getObjectIndex(type);
                if (classID == null) {
                    classID = classIndex.createObjectIndex(type);
                    out.write(TYPE.CUSTOM_CLASS.val);
                    Bytes.writeLength(classID, out);
                    Bytes.writeString(type.getName(), out);
                } else {
                    out.write(TYPE.CUSTOM_INDEX.val);
                    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);
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

            return;
        }
        ValueObject.TYPE objectType = val.getObjectType();
        switch (objectType) {
            case CUSTOM:
                ValueCustom custom = val.asCustom();
                Class<? extends ValueObject> type = custom.getClass();
                Integer classID = classIndex.getObjectIndex(type);
                if (classID == null) {
                    classID = classIndex.createObjectIndex(type);
                    out.write(TYPE.CUSTOM_CLASS.val);
                    Bytes.writeLength(classID, out);
                    Bytes.writeString(type.getName(), out);
                } else {
                    out.write(TYPE.CUSTOM_INDEX.val);
                    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);
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

            return;
        }
        ValueObject.TYPE objectType = val.getObjectType();
        switch (objectType) {
            case CUSTOM:
                ValueCustom custom = val.asCustom();
                Class<? extends ValueObject> type = custom.getContainerClass();
                Integer classID = classIndex.getObjectIndex(type);
                if (classID == null) {
                    classID = classIndex.createObjectIndex(type);
                    out.write(TYPE.CUSTOM_CLASS.val);
                    Bytes.writeLength(classID, out);
                    Bytes.writeString(type.getName(), out);
                } else {
                    out.write(TYPE.CUSTOM_INDEX.val);
                    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);
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.ValueCustom

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.