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

com.github.liuanxin.api.model.DocumentInfo Maven / Gradle / Ivy

There is a newer version: 0.9.8
Show newest version
package com.github.liuanxin.api.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.github.liuanxin.api.util.Tools;

import java.util.*;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class DocumentInfo {

    private List tokenList;
    private List responseList;
    /**
     * 
     * public enum Gender { // This enum will collect to: { Gender: [ "Nil", "Male", "Female" ] }
     *   Nil, Male, Female;
     * }
     *
     *
     * public enum Gender { // This enum will collect to: { Gender: { "0": "Nil", "1": "Male", "2": "Female" } }
     *   Nil(0), Male(1), Female(2);
     *
     *   int code;
     *   Gender(int code) { this.code = code; }
     *
     *   public int getCode() { return code; }
     * }
     *
     *
     * public enum Gender { // This enum will collect to: { gender: { "0": "未知", "1": "男", "2": "女" } }
     *   Nil(0, "未知"), Male(1, "男"), Female(2, "女");
     *
     *   int code;
     *   String value;
     *   Gender(int code, String value) { this.code = code; this.value = value; }
     *
     *   public int getCode() { return code; }
     *   public String getValue() { return value; }
     * }
     * 
*/ private Map enumInfo; private List moduleList; public List getTokenList() { return tokenList; } public DocumentInfo setTokenList(List tokenList) { this.tokenList = tokenList; return this; } public List getResponseList() { return responseList; } public DocumentInfo setResponseList(List responseList) { this.responseList = responseList; return this; } public Map getEnumInfo() { return enumInfo; } public DocumentInfo setEnumInfo(Map enumInfo) { this.enumInfo = enumInfo; return this; } public List getModuleList() { return moduleList; } public DocumentInfo setModuleList(List moduleList) { this.moduleList = moduleList; return this; } public void append(List projects) { if (Tools.isNotEmpty(projects)) { Set tokenSet = Tools.isEmpty(tokenList) ? new LinkedHashSet<>() : new LinkedHashSet<>(tokenList); Set responseSet = Tools.isEmpty(responseList) ? new LinkedHashSet<>() : new LinkedHashSet<>(responseList); Map enumMap = Tools.isEmpty(enumInfo) ? new LinkedHashMap<>() : new LinkedHashMap<>(enumInfo); Set moduleSet = Tools.isEmpty(moduleList) ? new LinkedHashSet<>() : new LinkedHashSet<>(moduleList); for (DocumentInfo info : projects) { tokenSet.addAll(info.getTokenList()); responseSet.addAll(info.getResponseList()); enumMap.putAll(info.getEnumInfo()); moduleSet.addAll(info.getModuleList()); } this.tokenList = new ArrayList<>(tokenSet); this.responseList = new ArrayList<>(responseSet); this.enumInfo = new LinkedHashMap<>(enumMap); this.moduleList = new ArrayList<>(moduleSet); } Collections.sort(responseList); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy