com.zeoflow.zson.ZsonCast Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zson Show documentation
Show all versions of zson Show documentation
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