1616
1717package com .google .gcloud .compute ;
1818
19- import static com .google .common .base .Preconditions .checkNotNull ;
20-
21- import com .google .common .base .MoreObjects .ToStringHelper ;
22-
23- import java .util .Objects ;
2419import java .util .regex .Matcher ;
2520import java .util .regex .Pattern ;
2621
2722/**
2823 * Identity for a Google Compute Engine global address.
2924 */
30- public final class GlobalAddressId extends ResourceId implements AddressId {
25+ public final class GlobalAddressId extends AddressId {
3126
3227 private static final String REGEX = ResourceId .REGEX + "global/addresses/([^/]+)" ;
3328 private static final Pattern PATTERN = Pattern .compile (REGEX );
3429 private static final long serialVersionUID = -2950815290049218593L ;
3530
36- private final String address ;
37-
3831 private GlobalAddressId (String project , String address ) {
39- super (project );
40- this .address = checkNotNull (address );
32+ super (project , address );
4133 }
4234
4335 @ Override
4436 public Type type () {
4537 return Type .GLOBAL ;
4638 }
4739
48- @ Override
49- public String address () {
50- return address ;
51- }
52-
5340 @ Override
5441 public String selfLink () {
55- return super .selfLink () + "/global/addresses/" + address ;
56- }
57-
58- @ Override
59- public ToStringHelper toStringHelper () {
60- return super .toStringHelper ().add ("address" , address );
42+ return super .selfLink () + "/global/addresses/" + address ();
6143 }
6244
6345 @ Override
6446 public int hashCode () {
65- return Objects . hash ( baseHashCode (), address );
47+ return baseHashCode ();
6648 }
6749
6850 @ Override
6951 public boolean equals (Object obj ) {
70- return obj instanceof GlobalAddressId
71- && baseEquals ((GlobalAddressId ) obj )
72- && Objects .equals (address , ((GlobalAddressId ) obj ).address );
52+ return obj instanceof GlobalAddressId && baseEquals ((GlobalAddressId ) obj );
7353 }
7454
7555 @ Override
7656 GlobalAddressId setProjectId (String projectId ) {
7757 if (project () != null ) {
7858 return this ;
7959 }
80- return GlobalAddressId .of (projectId , address );
60+ return GlobalAddressId .of (projectId , address () );
8161 }
8262
8363 /**
8464 * Returns an address identity given the address name. The address name must be 1-63 characters
85- * long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match
86- * the regular expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must
87- * be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit,
88- * except the last character, which cannot be a dash.
65+ * long and comply with RFC1035. Specifically, the name must match the regular expression
66+ * {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter,
67+ * and all following characters must be a dash, lowercase letter, or digit, except the last
68+ * character, which cannot be a dash.
8969 *
9070 * @see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a>
9171 */
@@ -95,10 +75,10 @@ public static GlobalAddressId of(String address) {
9575
9676 /**
9777 * Returns an address identity given project and address names. The address name must be 1-63
98- * characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long
99- * and match the regular expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first
100- * character must be a lowercase letter, and all following characters must be a dash, lowercase
101- * letter, or digit, except the last character, which cannot be a dash.
78+ * characters long and comply with RFC1035. Specifically, the name must match the regular
79+ * expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a
80+ * lowercase letter, and all following characters must be a dash, lowercase letter, or digit,
81+ * except the last character, which cannot be a dash.
10282 *
10383 * @see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a>
10484 */
0 commit comments