1 /* 2 * Copyright (C) 2023 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.app.admin; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.os.Parcel; 22 23 import java.util.Objects; 24 25 /** 26 * @hide 27 */ 28 public final class LongPolicyValue extends PolicyValue<Long> { 29 LongPolicyValue(long value)30 public LongPolicyValue(long value) { 31 super(value); 32 } 33 LongPolicyValue(Parcel source)34 private LongPolicyValue(Parcel source) { 35 this(source.readLong()); 36 } 37 38 @Override equals(@ullable Object o)39 public boolean equals(@Nullable Object o) { 40 if (this == o) return true; 41 if (o == null || getClass() != o.getClass()) return false; 42 LongPolicyValue other = (LongPolicyValue) o; 43 return Objects.equals(getValue(), other.getValue()); 44 } 45 46 @Override hashCode()47 public int hashCode() { 48 return Objects.hash(getValue()); 49 } 50 51 @Override toString()52 public String toString() { 53 return "LongPolicyValue { mValue= " + getValue() + " }"; 54 } 55 56 @Override describeContents()57 public int describeContents() { 58 return 0; 59 } 60 61 @Override writeToParcel(@onNull Parcel dest, int flags)62 public void writeToParcel(@NonNull Parcel dest, int flags) { 63 dest.writeLong(getValue()); 64 } 65 66 @NonNull 67 public static final Creator<LongPolicyValue> CREATOR = 68 new Creator<LongPolicyValue>() { 69 @Override 70 public LongPolicyValue createFromParcel(Parcel source) { 71 return new LongPolicyValue(source); 72 } 73 74 @Override 75 public LongPolicyValue[] newArray(int size) { 76 return new LongPolicyValue[size]; 77 } 78 }; 79 } 80