private int initFieldsFromClass(Class<?> initClass,
            Map<Integer, JsonFieldDeserializer> customEncoders,
            List<JsonFieldDeserializer> fieldsWithAnnotatoins,
            Map<Integer, JsonFieldDeserializer> idToFieldMap, Map<Integer, String> nameToFieldMap) {
        int maxFieldId = 0;
        if (!initClass.getSuperclass().equals(Object.class)) {
            maxFieldId = initFieldsFromClass(initClass.getSuperclass(), customEncoders,
                    fieldsWithAnnotatoins, idToFieldMap, nameToFieldMap);
        }

        for (Field f : initClass.getDeclaredFields()) {
            FieldId ann = f.getAnnotation(FieldId.class);
            if (ann != null) {
                JsonFieldDeserializer fldConv = null;
                maxFieldId = Math.max(maxFieldId, ann.value());
                String capFieldName = Character.toUpperCase(f.getName().charAt(0))
                        + f.getName().substring(1);
                Method setMethod;
                try {
                    setMethod = initClass.getDeclaredMethod("set" + capFieldName, f.getType());
                    if (customEncoders != null) {
                        fldConv = customEncoders.get(ann.value());
                    }
                    if (fldConv == null) {
                        JsonDeserializer deserializer = BaseTypeJsonFactory.newFieldDeserializerFor(f.getType());
                        if (deserializer == null) {
                            deserializer = new AnnotationBasedJsonDeserializer(f.getType());
                        }
                        fldConv = new JsonFieldDeserializer(deserializer);
                    }
                    fldConv.configure(setMethod);
                } catch (SecurityException e) {
                    throw new RuntimeException("No access to get/set method for field "
                            + f.getName(), e);
                } catch (NoSuchMethodException e) {
                    throw new RuntimeException("Missing get/set method for field " + f.getName(), e);
                }

                // fieldToIdMap.put(f, ann.id());
                idToFieldMap.put(ann.value(), fldConv);
                nameToFieldMap.put(ann.value(), capFieldName);
                fieldsWithAnnotatoins.add(fldConv);
            }
        }
        return maxFieldId;
    }