Coverage Summary for Class: PublicSuffixType (com.google.thirdparty.publicsuffix)
| Class | Class, % | Method, % | Line, % |
|---|---|---|---|
| PublicSuffixType | 0% (0/1) | 0% (0/5) | 0% (0/12) |
1 /* 2 * Copyright (C) 2013 The Guava Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 * in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the License 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 * or implied. See the License for the specific language governing permissions and limitations under 12 * the License. 13 */ 14 15 package com.google.thirdparty.publicsuffix; 16 17 import com.google.common.annotations.Beta; 18 import com.google.common.annotations.GwtCompatible; 19 20 /** 21 * <b>Do not use this class directly. For access to public-suffix information, use {@link 22 * com.google.common.net.InternetDomainName}.</b> 23 * 24 * <p>Specifies the type of a top-level domain definition. 25 * 26 * @since 23.3 27 */ 28 @Beta 29 @GwtCompatible 30 public enum PublicSuffixType { 31 32 /** Public suffix that is provided by a private company, e.g. "blogspot.com" */ 33 PRIVATE(':', ','), 34 /** Public suffix that is backed by an ICANN-style domain name registry */ 35 REGISTRY('!', '?'); 36 37 /** The character used for an inner node in the trie encoding */ 38 private final char innerNodeCode; 39 40 /** The character used for a leaf node in the trie encoding */ 41 private final char leafNodeCode; 42 43 PublicSuffixType(char innerNodeCode, char leafNodeCode) { 44 this.innerNodeCode = innerNodeCode; 45 this.leafNodeCode = leafNodeCode; 46 } 47 48 char getLeafNodeCode() { 49 return leafNodeCode; 50 } 51 52 char getInnerNodeCode() { 53 return innerNodeCode; 54 } 55 56 /** Returns a PublicSuffixType of the right type according to the given code */ 57 static PublicSuffixType fromCode(char code) { 58 for (PublicSuffixType value : values()) { 59 if (value.getInnerNodeCode() == code || value.getLeafNodeCode() == code) { 60 return value; 61 } 62 } 63 throw new IllegalArgumentException("No enum corresponding to given code: " + code); 64 } 65 }