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

Java tutorial

Introduction

Here is the source code for com.shampan.db.collections.fragment.status.ReferenceInfo.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;
import com.shampan.db.collections.fragment.page.PageInfo;
import java.util.List;

/**
 *
 * @author Sampan-IT
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ReferenceInfo {
    private String description;
    private List<Image> images;
    private UserInfo userInfo;
    private PageInfo pageInfo;

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<Image> getImages() {
        return images;
    }

    public void setImages(List<Image> images) {
        this.images = images;
    }

    public PageInfo getPageInfo() {
        return pageInfo;
    }

    public void setPageInfo(PageInfo pageInfo) {
        this.pageInfo = pageInfo;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }

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

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

}