public MaintenanceAssociation decode(ObjectNode json, CodecContext context, int mdNameLen) {
        if (json == null || !json.isObject()) {
            return null;
        }

        JsonNode maNode = json.get(MA);

        String maName = nullIsIllegal(maNode.get(MA_NAME), "maName is required").asText();
        String maNameType = MaIdShort.MaIdType.CHARACTERSTRING.name();
        if (maNode.get(MA_NAME_TYPE) != null) {
            maNameType = maNode.get(MA_NAME_TYPE).asText();
        }

        try {
            MaIdShort maId = MdMaNameUtil.parseMaName(maNameType, maName);
            MaBuilder builder =
                    DefaultMaintenanceAssociation.builder(maId, mdNameLen);

            JsonNode maNumericIdNode = maNode.get(MA_NUMERIC_ID);
            if (maNumericIdNode != null) {
                short mdNumericId = (short) maNumericIdNode.asInt();
                builder = builder.maNumericId(mdNumericId);
            }
            if (maNode.get(CCM_INTERVAL) != null) {
                builder.ccmInterval(CcmInterval.valueOf(maNode.get(CCM_INTERVAL).asText()));
            }

            List<Component> componentList = (new ComponentCodec()).decode((ArrayNode)
                    nullIsIllegal(maNode.get(COMPONENT_LIST),
                            "component-list is required"), context);
            for (Component component:componentList) {
                builder = builder.addToComponentList(component);
            }

            JsonNode rmepListJson = maNode.get(RMEP_LIST);
            if (rmepListJson != null) {
                List<MepId> remoteMeps = (new RMepCodec()).decode(
                        (ArrayNode) rmepListJson, context);
                for (MepId remoteMep:remoteMeps) {
                    builder = builder.addToRemoteMepIdList(remoteMep);
                }
            }

            return builder.build();
        } catch (CfmConfigException e) {
            throw new IllegalArgumentException(e);
        }

    }
@Test
    public void testDecodeMa1() throws IOException {
        String mdString = "{\"ma\": {    \"maName\": \"ma-1\"," +
                "\"maNameType\": \"CHARACTERSTRING\"," +
                "\"component-list\": [], " +
                "\"rmep-list\": [], " +
                "\"maNumericId\": 1}}";

        InputStream input = new ByteArrayInputStream(
                mdString.getBytes(StandardCharsets.UTF_8));
        JsonNode cfg = mapper.readTree(input);
        MaintenanceAssociation maDecode1 = ((MaintenanceAssociationCodec) context
                .codec(MaintenanceAssociation.class))
                .decode((ObjectNode) cfg, context, 10);
        assertEquals(MAID1_CHAR, maDecode1.maId());
        assertEquals(1, maDecode1.maNumericId());
    }