@Override
    public MaintenanceDomain decode(ObjectNode json, CodecContext context) {
        if (json == null || !json.isObject()) {
            return null;
        }

        JsonNode mdNode = json.get(MD);

        String mdName = nullIsIllegal(mdNode.get(MD_NAME), "mdName is required").asText();
        String mdNameType = MdId.MdNameType.CHARACTERSTRING.name();
        if (mdNode.get(MD_NAME_TYPE) != null) {
            mdNameType = mdNode.get(MD_NAME_TYPE).asText();
        }

        try {
            MdId mdId = MdMaNameUtil.parseMdName(mdNameType, mdName);
            MaintenanceDomain.MdBuilder builder = DefaultMaintenanceDomain.builder(mdId);
            JsonNode mdLevelNode = mdNode.get(MD_LEVEL);
            if (mdLevelNode != null) {
                MdLevel mdLevel = MdLevel.valueOf(mdLevelNode.asText());
                builder = builder.mdLevel(mdLevel);
            }
            JsonNode mdNumericIdNode = mdNode.get(MD_NUMERIC_ID);
            if (mdNumericIdNode != null) {
                short mdNumericId = (short) mdNumericIdNode.asInt();
                builder = builder.mdNumericId(mdNumericId);
            }

            return builder.build();
        } catch (CfmConfigException e) {
            throw new IllegalArgumentException(e);
        }
    }
@Test
    public void testDecodeMd4() throws IOException {
        String mdString = "{\"md\": {    \"mdName\": \"\"," +
                "\"mdNameType\": \"NONE\"}}";

        InputStream input = new ByteArrayInputStream(
                mdString.getBytes(StandardCharsets.UTF_8));
        JsonNode cfg = mapper.readTree(input);
        MaintenanceDomain mdDecode1 = context
                .codec(MaintenanceDomain.class).decode((ObjectNode) cfg, context);
        assertEquals(MDID4_NONE, mdDecode1.mdId());
    }