com.shampan.db.collections.fragment.status.ReferenceList.java Source code

Java tutorial

Introduction

Here is the source code for com.shampan.db.collections.fragment.status.ReferenceList.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.shampan.db.collections.fragment.status;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 *
 * @author Sampan-IT
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ReferenceList {

    private String statusId;

    public String getStatusId() {
        return statusId;
    }

    public void setStatusId(String statusId) {
        this.statusId = statusId;
    }

    @Override
    public String toString() {
        ObjectMapper mapper = new ObjectMapper();
        String json = "";
        try {
            json = mapper.writeValueAsString(this);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return json;
    }

    public static ReferenceList getReferenceList(String jsonContent) {
        ReferenceList refList = null;
        try {
            ObjectMapper mapper = new ObjectMapper();
            refList = mapper.readValue(jsonContent, ReferenceList.class);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return refList;
    }

}