MCPcopy Create free account
hub / github.com/grpc/grpc-java / Uri

Method Uri

api/src/main/java/io/grpc/Uri.java:173–192  ·  view source on GitHub ↗
(Builder builder)

Source from the content-addressed store, hash-verified

171 @Nullable private final String fragment;
172
173 private Uri(Builder builder) {
174 this.scheme = checkNotNull(builder.scheme, "scheme");
175 this.userInfo = builder.userInfo;
176 this.host = builder.host;
177 this.port = builder.port;
178 this.path = builder.path;
179 this.query = builder.query;
180 this.fragment = builder.fragment;
181
182 // Checks common to the parse() and Builder code paths.
183 if (hasAuthority()) {
184 if (!path.isEmpty() && !path.startsWith("/")) {
185 throw new IllegalArgumentException("Has authority -- Non-empty path must start with '/'");
186 }
187 } else {
188 if (path.startsWith("//")) {
189 throw new IllegalArgumentException("No authority -- Path cannot start with '//'");
190 }
191 }
192 }
193
194 /**
195 * Parses a URI from its string form.

Callers

nothing calls this directly

Calls 3

hasAuthorityMethod · 0.95
checkNotNullMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected