Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@

package com.google.firestore.v1beta1;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.api.pathtemplate.PathTemplate;
import com.google.api.resourcenames.ResourceName;
import java.util.Map;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

// AUTO-GENERATED DOCUMENTATION AND CLASS
@javax.annotation.Generated("by GAPIC protoc plugin")
public class AnyPathName implements ResourceName {

private static final PathTemplate PATH_TEMPLATE =
PathTemplate.createWithoutUrlEncoding("projects/{project}/databases/{database}/documents/{document}/{any_path=**}");
PathTemplate.createWithoutUrlEncoding(
"projects/{project}/databases/{database}/documents/{document}/{any_path=**}");

private volatile Map<String, String> fieldValuesMap;

Expand Down Expand Up @@ -69,30 +70,35 @@ private AnyPathName(Builder builder) {

public static AnyPathName of(String project, String database, String document, String anyPath) {
return newBuilder()
.setProject(project)
.setDatabase(database)
.setDocument(document)
.setAnyPath(anyPath)
.build();
.setProject(project)
.setDatabase(database)
.setDocument(document)
.setAnyPath(anyPath)
.build();
}

public static String format(String project, String database, String document, String anyPath) {
return newBuilder()
.setProject(project)
.setDatabase(database)
.setDocument(document)
.setAnyPath(anyPath)
.build()
.toString();
.setProject(project)
.setDatabase(database)
.setDocument(document)
.setAnyPath(anyPath)
.build()
.toString();
}

public static AnyPathName parse(String formattedString) {
if (formattedString.isEmpty()) {
return null;
}
Map<String, String> matchMap =
PATH_TEMPLATE.validatedMatch(formattedString, "AnyPathName.parse: formattedString not in valid format");
return of(matchMap.get("project"), matchMap.get("database"), matchMap.get("document"), matchMap.get("any_path"));
PATH_TEMPLATE.validatedMatch(
formattedString, "AnyPathName.parse: formattedString not in valid format");
return of(
matchMap.get("project"),
matchMap.get("database"),
matchMap.get("document"),
matchMap.get("any_path"));
}

public static List<AnyPathName> parseList(List<String> formattedStrings) {
Expand Down Expand Up @@ -141,7 +147,8 @@ public String getFieldValue(String fieldName) {

@Override
public String toString() {
return PATH_TEMPLATE.instantiate("project", project, "database", database, "document", document, "any_path", anyPath);
return PATH_TEMPLATE.instantiate(
"project", project, "database", database, "document", document, "any_path", anyPath);
}

/** Builder for AnyPathName. */
Expand Down Expand Up @@ -188,8 +195,7 @@ public Builder setAnyPath(String anyPath) {
return this;
}

private Builder() {
}
private Builder() {}

private Builder(AnyPathName anyPathName) {
project = anyPathName.project;
Expand Down Expand Up @@ -232,4 +238,3 @@ public int hashCode() {
return h;
}
}

Loading