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

com.global.api.network.entities.gnap.MapGnapFids Maven / Gradle / Ivy

There is a newer version: 14.2.3
Show newest version
package com.global.api.network.entities.gnap;

import com.global.api.entities.enums.ControlCodes;
import com.global.api.entities.enums.IStringConstant;
import com.global.api.network.enums.gnap.GnapFIDS;
import com.global.api.network.enums.gnap.GnapSubFids;
import com.global.api.utils.MessageWriter;
import com.global.api.utils.GnapUtils;

public class MapGnapFids {
    MessageWriter mr;
    public MapGnapFids(MessageWriter mr)
    {
        this.mr=mr;
    }

    public  MapGnapFids() {
        mr=new MessageWriter();
    }

    public void addFid(GnapFIDS id,String value) {
        add(id,value);
    }

    public void addSubFid(GnapSubFids id, String value) {
        add(id,value);
    }

    public  void addFid(GnapFIDS id,T value) {
        add(id,value);
    }

    public  void addSubFid(GnapFIDS id,T value) {
        add(id,value);
    }

    public void add(GnapFIDS id,String value) {
        if (value != null) {
            GnapUtils.log("FID " + id.getValue() + " (" + id.getFidDesc() + ")", value);
            mr.add(ControlCodes.FS);
            mr.addRange(id.getBytes());
            mr.addRange(value.getBytes());
        }
    }
    public void add(GnapSubFids id,String value) {
        if (value != null) {
            GnapUtils.log("SUBFID " + id.getValue() + " (" + id.getFidDesc() + ")", value);
            mr.add(ControlCodes.RS);
            mr.addRange(id.getBytes());
            mr.addRange(value.getBytes());
        }
    }

    public  void add(GnapFIDS id,T value) {
        if(value!=null) {
            add(id, value.getValue());
        }
    }

    public  void add(GnapSubFids id,T value) {
        if(value!=null) {
            add(id, value.getValue());
        }
    }

    public  void add(T desc, String value) {
        GnapUtils.log(desc.getValue(),value);
        mr.addRange(value.getBytes());
    }

    public void add(String value) {
        mr.addRange(value.getBytes());
    }

    public MessageWriter getWriterObject() {
        return mr;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy