32
32
import com .google .api .core .BetaApi ;
33
33
import com .google .api .core .InternalExtensionOnly ;
34
34
import com .google .api .gax .rpc .StatusCode ;
35
+ import com .google .api .gax .rpc .StatusCode .Code ;
35
36
import com .google .common .base .Strings ;
36
37
import java .util .Objects ;
37
38
@@ -46,22 +47,22 @@ public class HttpJsonStatusCode implements StatusCode {
46
47
static final String UNKNOWN = "UNKNOWN" ;
47
48
48
49
private final int httpStatus ;
49
- private final StatusCode . Code statusCode ;
50
+ private final Code statusCode ;
50
51
51
52
/** Creates a new instance with the given status code. */
52
53
public static HttpJsonStatusCode of (int httpStatus , String errorMessage ) {
53
54
return new HttpJsonStatusCode (httpStatus , httpStatusToStatusCode (httpStatus , errorMessage ));
54
55
}
55
56
56
- public static HttpJsonStatusCode of (StatusCode . Code statusCode ) {
57
+ public static HttpJsonStatusCode of (Code statusCode ) {
57
58
return new HttpJsonStatusCode (statusCode .getHttpStatusCode (), statusCode );
58
59
}
59
60
60
61
public static HttpJsonStatusCode of (com .google .rpc .Code rpcCode ) {
61
- return new HttpJsonStatusCode ( rpcCode . getNumber (), rpcCodeToStatusCode (rpcCode ));
62
+ return HttpJsonStatusCode . of ( rpcCodeToStatusCode (rpcCode ));
62
63
}
63
64
64
- static StatusCode . Code rpcCodeToStatusCode (com .google .rpc .Code rpcCode ) {
65
+ static Code rpcCodeToStatusCode (com .google .rpc .Code rpcCode ) {
65
66
switch (rpcCode ) {
66
67
case OK :
67
68
return Code .OK ;
@@ -102,7 +103,7 @@ static StatusCode.Code rpcCodeToStatusCode(com.google.rpc.Code rpcCode) {
102
103
}
103
104
}
104
105
105
- static StatusCode . Code httpStatusToStatusCode (int httpStatus , String errorMessage ) {
106
+ static Code httpStatusToStatusCode (int httpStatus , String errorMessage ) {
106
107
String causeMessage = Strings .nullToEmpty (errorMessage ).toUpperCase ();
107
108
switch (httpStatus ) {
108
109
case 200 :
@@ -155,7 +156,7 @@ static StatusCode.Code httpStatusToStatusCode(int httpStatus, String errorMessag
155
156
}
156
157
157
158
@ Override
158
- public StatusCode . Code getCode () {
159
+ public Code getCode () {
159
160
return statusCode ;
160
161
}
161
162
@@ -165,8 +166,8 @@ public Integer getTransportCode() {
165
166
return httpStatus ;
166
167
}
167
168
168
- private HttpJsonStatusCode (int code , StatusCode . Code statusCode ) {
169
- this .httpStatus = code ;
169
+ private HttpJsonStatusCode (int httpStatus , Code statusCode ) {
170
+ this .httpStatus = httpStatus ;
170
171
this .statusCode = statusCode ;
171
172
}
172
173
0 commit comments