class FieldPath {

  static FieldPath fromDotSeparatedPath(@NonNull String path) {
    checkNotNull(path, "Provided field path must not be null.");
    checkArgument(
        !RESERVED.matcher(path).find(), "Use FieldPath.of() for field names containing '~*/[]'.");
    try {
      // By default, split() doesn't return empty leading and trailing segments. This can be enabled
      // by passing "-1" as the  limit.
      return com.google.firebase.firestore.FieldPath.of(path.split("\\.", -1));
    } catch (IllegalArgumentException e) {
      throw new IllegalArgumentException(
          "Invalid field path ("
              + path
              + "). Paths must not be empty, begin with '.', end with '.', or contain '..'");
    }
  }

  private  FieldPath(List<String> segments);
  private  FieldPath(com.google.firebase.firestore.model.FieldPath internalPath);

}