public static TypeRef parseFromJson(String typeRefString) {

    String moduleName = null;
    String name;
    boolean isList;
    boolean isMap;

    if (typeRefString.endsWith("[]")) {
      name = typeRefString.substring(0, typeRefString.length() - 2);
      isList = true;
      isMap = false;
    } else if (typeRefString.endsWith("<>")) {
      name = typeRefString.substring(0, typeRefString.length() - 2);
      isList = false;
      isMap = true;
    } else {
      name = typeRefString;
      isList = false;
      isMap = false;
    }

    String[] parts = name.split("\\.");
    if (parts.length == 2) {
      moduleName = parts[0];
      name = parts[1];
    } else if (parts.length > 2) {
      throw new KurentoModuleCreatorException("Invalid module name in type ref: '" + name + "'");
    }

    return new TypeRef(moduleName, name, isList, isMap);
  }