You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/05/17 16:40:47 UTC

[GitHub] [phoenix-queryserver] stoty commented on a change in pull request #33: PHOENIX-5826 Remove guava from queryserver

stoty commented on a change in pull request #33:
URL: https://github.com/apache/phoenix-queryserver/pull/33#discussion_r426280769



##########
File path: queryserver/src/main/java/org/apache/phoenix/util/HostAndPort.java
##########
@@ -0,0 +1,284 @@
+/*
+ * Copyright (C) 2011 The Guava Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.util;
+
+import java.io.Serializable;
+import java.util.Objects;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.annotation.concurrent.Immutable;
+
+/**
+ * An immutable representation of a host and port.
+ *
+ * <p>Example usage:
+ * <pre>
+ * HostAndPort hp = HostAndPort.fromString("[2001:db8::1]")
+ *     .withDefaultPort(80)
+ *     .requireBracketsForIPv6();
+ * hp.getHostText();  // returns "2001:db8::1"
+ * hp.getPort();      // returns 80
+ * hp.toString();     // returns "[2001:db8::1]:80"
+ * </pre>
+ *
+ * <p>Here are some examples of recognized formats:
+ * <ul>
+ *   <li>example.com
+ *   <li>example.com:80
+ *   <li>192.0.2.1
+ *   <li>192.0.2.1:80
+ *   <li>[2001:db8::1]     - {@link #getHostText()} omits brackets
+ *   <li>[2001:db8::1]:80  - {@link #getHostText()} omits brackets
+ *   <li>2001:db8::1       - Use {@link #requireBracketsForIPv6()} to prohibit this
+ * </ul>
+ *
+ * <p>Note that this is not an exhaustive list, because these methods are only
+ * concerned with brackets, colons, and port numbers.  Full validation of the
+ * host field (if desired) is the caller's responsibility.
+ *
+ * @author Paul Marks
+ * @since 10.0

Review comment:
       Yes, done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org