All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codingapi.tx.framework.utils.SerializerUtils Maven / Gradle / Ivy

There is a newer version: 4.1.0
Show newest version
package com.codingapi.tx.framework.utils;

import com.lorne.core.framework.exception.SerializerException;


import com.codingapi.tx.model.TransactionInvocation;
import com.codingapi.tx.framework.utils.serializer.ISerializer;
import com.codingapi.tx.framework.utils.serializer.ProtostuffSerializer;

/**
 * create by lorne on 2017/8/3
 */
public class SerializerUtils {


    private static ISerializer serializer = new ProtostuffSerializer();


    public static byte[] serializeTransactionInvocation(TransactionInvocation invocation)   {
        try {
            return serializer.serialize(invocation);
        } catch (SerializerException e) {
            e.printStackTrace();
            return null;
        }
    }


    public static TransactionInvocation parserTransactionInvocation(byte[] value)  {
        try {
            return serializer.deSerialize(value, TransactionInvocation.class);
        } catch (SerializerException e) {
            e.printStackTrace();
            return null;
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy