docs: private static CodeDependent createCodeByType(ProtoFile protoFile, MessageType type, Set<String> enumNames,
              boolean topLevelClass, List<Type> parentNestedTypes, List<CodeDependent> cds, Set<String> packages,
              Map<String, String> uniMappedName, boolean isUniName) {
  
          CodeDependent cd = new CodeDependent();
  
          String packageName = protoFile.getPackageName();
          String defaultClsName = type.getName();
          // to check if has "java_package" option and "java_outer_classname"
          List<Option> options = protoFile.getOptions();
          if (options != null) {
              for (Option option : options) {
                  if (option.getName().equals(JAVA_PACKAGE_OPTION)) {
                      packageName = option.getValue().toString();
                  }
              }
          }
  
          String simpleName = getProxyClassName(defaultClsName, uniMappedName, isUniName);
  
          // To generate class
          StringBuilder code = new StringBuilder();
          if (topLevelClass) {
              // define package
              if (!StringUtils.isEmpty(packageName)) {
                  code.append("package ").append(packageName).append(CODE_END);
                  code.append("\n");
              }
              // add import;
              code.append("import com.baidu.bjf.remoting.protobuf.FieldType;\n");
              code.append("import com.baidu.bjf.remoting.protobuf.EnumReadable;\n");
              code.append("import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;\n");
          }
  
          // define class
          String clsName;
          if (topLevelClass) {
              clsName = "public class ";
          } else {
              clsName = "public static class ";
          }
          code.append(clsName).append(simpleName).append(" {\n");
  
          List<Field> fields = type.getFields();
  
          // get nested types
          List<Type> nestedTypes = fetchAllNestedTypes(type, true);
          List<Type> checkNestedTypes = new ArrayList<Type>(nestedTypes);
  
          // to check if has nested classes and check has Enum type
          for (Type t : nestedTypes) {
              if (t instanceof EnumType) {
                  enumNames.add(t.getName());
                  enumNames.add(t.getFullyQualifiedName());
                  if (!StringUtils.isEmpty(packageName)) {
                      enumNames.add(StringUtils.removeStart(t.getFullyQualifiedName(), packageName + PACKAGE_SPLIT));
                  }
              } else {
                  checkNestedTypes.add(t);
              }
          }
  
          checkNestedTypes.addAll(parentNestedTypes);
  
          String suffix = "";
          for (Field field : fields) {
              // define annotation
              generateProtobufDefinedForField(code, field, enumNames);
  
              FieldType fType = typeMapping.get(field.getType());
              String javaType = "";
              if (fType == null) {
                  String jType = field.getType();
                  javaType = getProxyClassName(jType, packages, uniMappedName, isUniName);
  
                  if (!isNestedTypeDependency(field.getType(), checkNestedTypes)) {
                      cd.addDependency(javaType);
                  }
              } else {
                  javaType = fType.getJavaType();
                  suffix = fType.getSuffix();
              }
  
              // check if repeated type
              if (Label.REPEATED == field.getLabel()) {
                  javaType = List.class.getName() + "<" + javaType + ">";
              }
  
              // define field
              code.append("public ").append(javaType);
              code.append(" ").append(field.getName());
  
              // check if has default
              Option defaultOption = Option.findByName(field.getOptions(), "default");
              if (defaultOption != null) {
                  code.append("=");
                  Object defaultValue = defaultOption.getValue();
                  // if is enum type
                  if (defaultValue instanceof EnumType.Value) {
                      EnumType.Value enumValue = (EnumType.Value) defaultValue;
                      code.append(javaType).append(PACKAGE_SPLIT_CHAR).append(enumValue.getName());
                  } else if (defaultValue instanceof String) {
                      code.append("\"").append(defaultValue).append("\"");
                  } else {
                      code.append(String.valueOf(defaultValue) + suffix);
                  }
              }
  
              code.append(CODE_END);
          }
  
          // to check if has nested classes
          if (nestedTypes != null) {
              for (Type t : nestedTypes) {
                  CodeDependent nestedCd;
                  String fqname = t.getFullyQualifiedName();
                  if (!StringUtils.isEmpty(packageName)) {
                      fqname = StringUtils.removeStart(t.getFullyQualifiedName(), packageName + PACKAGE_SPLIT_CHAR);
                  }
                  String subClsName = getProxyClassName(fqname, uniMappedName, isUniName);
  
                  if (t instanceof EnumType) {
                      nestedCd = createCodeByType((EnumType) t, false, packageName, uniMappedName, isUniName);
                      enumNames.add(t.getName());
                  } else {
                      nestedCd = createCodeByType(protoFile, (MessageType) t, enumNames, false, checkNestedTypes, cds,
                              getPackages(cds), uniMappedName, isUniName);
                  }
                  nestedCd.addSubClass(subClsName);
                  nestedCd.addSubClass(packageName + PACKAGE_SPLIT_CHAR + subClsName);
  
                  code.append(nestedCd.code);
                  // merge dependency
                  cd.dependencies.addAll(nestedCd.dependencies);
  
                  cd.subClasses.addAll(nestedCd.subClasses);
              }
          }
  
          code.append("}\n");
  
          cd.name = simpleName;
          cd.pkg = packageName;
          cd.code = code.toString();
  
          // finally dependency should remove self
          cd.dependencies.remove(cd.name);
  
          // also remove parent include
          if (!parentNestedTypes.isEmpty()) {
              for (Type t : checkNestedTypes) {
                  Iterator<String> iterator = cd.dependencies.iterator();
                  while (iterator.hasNext()) {
                      String dependName = iterator.next();
                      if (!StringUtils.isEmpty(DEFAULT_SUFFIX_CLASSNAME)) {
                          dependName = dependName.replaceAll(DEFAULT_SUFFIX_CLASSNAME, "");
                      }
                      if (t.getFullyQualifiedName().endsWith(dependName)) {
                          iterator.remove();
                      }
                  }
              }
          }
  
          return cd;
      }