1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.net;
18 
19 import android.annotation.NonNull;
20 import android.annotation.SystemApi;
21 import android.os.Parcel;
22 import android.os.Parcelable;
23 
24 import java.util.Objects;
25 
26 /** @hide */
27 @SystemApi
28 public final class EthernetNetworkManagementException
29         extends RuntimeException implements Parcelable {
30 
31     /* @hide */
EthernetNetworkManagementException(@onNull final String errorMessage)32     public EthernetNetworkManagementException(@NonNull final String errorMessage) {
33         super(errorMessage);
34     }
35 
36     @Override
hashCode()37     public int hashCode() {
38         return Objects.hash(getMessage());
39     }
40 
41     @Override
equals(Object obj)42     public boolean equals(Object obj) {
43         if (this == obj) return true;
44         if (obj == null || getClass() != obj.getClass()) return false;
45         final EthernetNetworkManagementException that = (EthernetNetworkManagementException) obj;
46 
47         return Objects.equals(getMessage(), that.getMessage());
48     }
49 
50     @Override
writeToParcel(@onNull Parcel dest, int flags)51     public void writeToParcel(@NonNull Parcel dest, int flags) {
52         dest.writeString(getMessage());
53     }
54 
55     @Override
describeContents()56     public int describeContents() {
57         return 0;
58     }
59 
60     @NonNull
61     public static final Parcelable.Creator<EthernetNetworkManagementException> CREATOR =
62             new Parcelable.Creator<EthernetNetworkManagementException>() {
63                 @Override
64                 public EthernetNetworkManagementException[] newArray(int size) {
65                     return new EthernetNetworkManagementException[size];
66                 }
67 
68                 @Override
69                 public EthernetNetworkManagementException createFromParcel(@NonNull Parcel source) {
70                     return new EthernetNetworkManagementException(source.readString());
71                 }
72             };
73 }
74