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

com.zeoflow.zson.ZsonCast Maven / Gradle / Ivy

Go to download

A Java serialization/deserialization library - convert Java Objects easier into JSON and back.

The newest version!
package com.zeoflow.zson;

import java.lang.reflect.Type;

public class ZsonCast
{

    private Object oldObject;
    private Object classOfT;

    public ZsonCast(Object oldObject)
    {
        this.oldObject = oldObject;
    }

    public static ZsonCast fromObject(Object oldObject)
    {
        return new ZsonCast(oldObject);
    }

    public  ZsonCast toObject(Class classOfT)
    {
        this.classOfT = classOfT;
        return this;
    }

    public  T cast()
    {
        Zson zson = new Zson();
        String json = zson.toJson(this.oldObject);
        Object object = zson.fromJson(json, (Type) this.classOfT);
        return (T) object;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy