public static ProtocolDeserializer getProtocolDeserializer(String jsonStr) throws JsonParseException, JsonMappingException, IOException{
        final ProtocolPair p = mapper.readValue(jsonStr, ProtocolPair.class);
        Protocol pp = null;
        if(p.getType() != null){
            pp = (Protocol) mapper.readValue(p.getProtocol(), p.getType());
        }
        final Protocol resp = pp;

        return new ProtocolDeserializer(){

            @Override
            public ProtocolHeader deserializerProtocolHeader() {
                return p.getProtocolHeader();
            }

            @Override
            public Protocol deserializerProtocol() {
                return resp;
            }

        };
    }
public static ProtocolDeserializer getProtocolDeserializer ( String jsonStr ) throws JsonParseException , JsonMappingException , IOException { final ProtocolPair p = mapper . readValue ( jsonStr , ProtocolPair . class ) ; Protocol pp = null ; if ( p . getType ( ) != null ) { pp = ( Protocol ) mapper . readValue ( p . getProtocol ( ) , p . getType ( ) ) ; } final Protocol resp = pp ; return new ProtocolDeserializer ( ) { @ Override public ProtocolHeader deserializerProtocolHeader ( ) { return p . getProtocolHeader ( ) ; } @ Override public Protocol deserializerProtocol ( ) { return resp ; } } ; }
Deserialize the Protocol Json String.

@param jsonStr
the Protocol Json String
@return
the ProtocolDeserializer.
@throws JsonParseException
@throws JsonMappingException
@throws IOException