net.sf.jetro.object.serializer.addons.DateSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jetro-object Show documentation
Show all versions of jetro-object Show documentation
JSON to Java Object Mapper for the Jetro JSON Transformation Engine
The newest version!
package net.sf.jetro.object.serializer.addons;
import java.util.Date;
import net.sf.jetro.object.serializer.TypeSerializer;
import net.sf.jetro.visitor.JsonVisitor;
public class DateSerializer implements TypeSerializer {
@Override
public boolean canSerialize(Object toSerialize) {
return toSerialize instanceof Date;
}
@Override
public void serialize(Date toSerialize, JsonVisitor> recipient) {
recipient.visitValue(toSerialize.getTime());
}
}