package com.brilliance.isc.swift.objmtconvert.manager;

import com.brilliance.isc.swift.objmtconvert.model.AbsMTCreator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import com.google.gson.Gson;

/**
 * @author gechengyang
 * @date 2023/2/18
 */
public class MtHandler {

    private AbsMTCreator newAbsMTCreator;//重构克隆得到新的AbsMTCreator

  //  private MtResult mtResult;
   // private final String msgType;

    public MtHandler(AbsMTCreator oldAbsMTCreator,MtResult mtResult) throws Exception {

//        String msgType = oldAbsMTCreator.getMsgType();
//        String className = "com.brilliance.isc.swift.objmtconvert.model.mt" + msgType.charAt(0) + "xx.MT" + msgType + "Creator";
//        Class cls = Class.forName(className);
//        AbsMTCreator absMTCreatorClone = (AbsMTCreator) new Gson().fromJson(oldAbsMTCreator.getJsonData(), cls);
//        absMTCreatorClone.setJsonMap(oldAbsMTCreator.getJsonMap());
//        absMTCreatorClone.setJsonData(oldAbsMTCreator.getJsonData());
//        absMTCreatorClone.setAbstractMT(oldAbsMTCreator.getAbstractMT());
        this.newAbsMTCreator=oldAbsMTCreator;
        this.newAbsMTCreator.setMtResult(mtResult);
    }



    public void packMsg() {
       // MtResult result = this.newAbsMTCreator.pack();
      //  return result;
        this.newAbsMTCreator.pack();
    }


}
