package com.mvc.netty;

import com.mvc.netty.dealconstant.HandleMsgCode;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class ParserFactory {
    @Resource
    private RegularMessageParser regularMessageParser;
    @Resource
    private ReissueMessageParser reissueMessageParser;

    public MessageParser getInstance(HandleMsgCode funCode) {
        MessageParser instance = null;

        if (funCode == HandleMsgCode.H_32) {    // 定时报
            instance = regularMessageParser;
        } else if (funCode == HandleMsgCode.H_52) {
            instance = reissueMessageParser;
        }
        return instance;
    }
}
