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

org.vfdtech.models.Jsonable Maven / Gradle / Ivy

Go to download

A utilities service with generic tools implementation. Can be plugged into your java project. This is designed for Java 1.8

There is a newer version: 1.0.0
Show newest version
package org.vfdtech.models;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

@SuperBuilder
@AllArgsConstructor
public class Jsonable {

    public String toJsonString(){
        ObjectMapper objectMapper = new ObjectMapper();

        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return "";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy