1 /*
2  * Copyright (C) 2024 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 com.android.federatedcompute.services.data;
18 
19 import android.annotation.NonNull;
20 
21 import com.android.ondevicepersonalization.internal.util.AnnotationValidations;
22 import com.android.ondevicepersonalization.internal.util.DataClass;
23 
24 @DataClass(genHiddenBuilder = true, genEqualsHashCode = true)
25 public class ODPAuthorizationToken {
26     @NonNull private final String mOwnerIdentifier;
27 
28     @NonNull private final String mAuthorizationToken;
29 
30     @NonNull private final long mCreationTime;
31 
32     @NonNull private final long mExpiryTime;
33 
34     // Code below generated by codegen v1.0.23.
35     //
36     // DO NOT MODIFY!
37     // CHECKSTYLE:OFF Generated code
38     //
39     // To regenerate run:
40     // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/federatedcompute/src/com/android/federatedcompute/services/data/ODPAuthorizationToken.java
41     //
42     // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
43     //   Settings > Editor > Code Style > Formatter Control
44     //@formatter:off
45 
46 
47     @DataClass.Generated.Member
ODPAuthorizationToken( @onNull String ownerIdentifier, @NonNull String authorizationToken, @NonNull long creationTime, @NonNull long expiryTime)48     /* package-private */ ODPAuthorizationToken(
49             @NonNull String ownerIdentifier,
50             @NonNull String authorizationToken,
51             @NonNull long creationTime,
52             @NonNull long expiryTime) {
53         this.mOwnerIdentifier = ownerIdentifier;
54         AnnotationValidations.validate(
55                 NonNull.class, null, mOwnerIdentifier);
56         this.mAuthorizationToken = authorizationToken;
57         AnnotationValidations.validate(
58                 NonNull.class, null, mAuthorizationToken);
59         this.mCreationTime = creationTime;
60         AnnotationValidations.validate(
61                 NonNull.class, null, mCreationTime);
62         this.mExpiryTime = expiryTime;
63         AnnotationValidations.validate(
64                 NonNull.class, null, mExpiryTime);
65 
66         // onConstructed(); // You can define this method to get a callback
67     }
68 
69     @DataClass.Generated.Member
getOwnerIdentifier()70     public @NonNull String getOwnerIdentifier() {
71         return mOwnerIdentifier;
72     }
73 
74     @DataClass.Generated.Member
getAuthorizationToken()75     public @NonNull String getAuthorizationToken() {
76         return mAuthorizationToken;
77     }
78 
79     @DataClass.Generated.Member
getCreationTime()80     public @NonNull long getCreationTime() {
81         return mCreationTime;
82     }
83 
84     @DataClass.Generated.Member
getExpiryTime()85     public @NonNull long getExpiryTime() {
86         return mExpiryTime;
87     }
88 
89     @Override
90     @DataClass.Generated.Member
equals(@ndroid.annotation.Nullable Object o)91     public boolean equals(@android.annotation.Nullable Object o) {
92         // You can override field equality logic by defining either of the methods like:
93         // boolean fieldNameEquals(ODPAuthorizationToken other) { ... }
94         // boolean fieldNameEquals(FieldType otherValue) { ... }
95 
96         if (this == o) return true;
97         if (o == null || getClass() != o.getClass()) return false;
98         @SuppressWarnings("unchecked")
99         ODPAuthorizationToken that = (ODPAuthorizationToken) o;
100         //noinspection PointlessBooleanExpression
101         return true
102                 && java.util.Objects.equals(mOwnerIdentifier, that.mOwnerIdentifier)
103                 && java.util.Objects.equals(mAuthorizationToken, that.mAuthorizationToken)
104                 && mCreationTime == that.mCreationTime
105                 && mExpiryTime == that.mExpiryTime;
106     }
107 
108     @Override
109     @DataClass.Generated.Member
hashCode()110     public int hashCode() {
111         // You can override field hashCode logic by defining methods like:
112         // int fieldNameHashCode() { ... }
113 
114         int _hash = 1;
115         _hash = 31 * _hash + java.util.Objects.hashCode(mOwnerIdentifier);
116         _hash = 31 * _hash + java.util.Objects.hashCode(mAuthorizationToken);
117         _hash = 31 * _hash + Long.hashCode(mCreationTime);
118         _hash = 31 * _hash + Long.hashCode(mExpiryTime);
119         return _hash;
120     }
121 
122     /**
123      * A builder for {@link ODPAuthorizationToken}
124      * @hide
125      */
126     @SuppressWarnings("WeakerAccess")
127     @DataClass.Generated.Member
128     public static class Builder {
129 
130         private @NonNull String mOwnerIdentifier;
131         private @NonNull String mAuthorizationToken;
132         private @NonNull long mCreationTime;
133         private @NonNull long mExpiryTime;
134 
135         private long mBuilderFieldsSet = 0L;
136 
Builder()137         public Builder() {}
138 
Builder( @onNull String ownerIdentifier, @NonNull String authorizationToken, @NonNull long creationTime, @NonNull long expiryTime)139         public Builder(
140                 @NonNull String ownerIdentifier,
141                 @NonNull String authorizationToken,
142                 @NonNull long creationTime,
143                 @NonNull long expiryTime) {
144             mOwnerIdentifier = ownerIdentifier;
145             AnnotationValidations.validate(
146                     NonNull.class, null, mOwnerIdentifier);
147             mAuthorizationToken = authorizationToken;
148             AnnotationValidations.validate(
149                     NonNull.class, null, mAuthorizationToken);
150             mCreationTime = creationTime;
151             AnnotationValidations.validate(
152                     NonNull.class, null, mCreationTime);
153             mExpiryTime = expiryTime;
154             AnnotationValidations.validate(
155                     NonNull.class, null, mExpiryTime);
156         }
157 
158         @DataClass.Generated.Member
setOwnerIdentifier(@onNull String value)159         public @NonNull Builder setOwnerIdentifier(@NonNull String value) {
160             checkNotUsed();
161             mBuilderFieldsSet |= 0x1;
162             mOwnerIdentifier = value;
163             return this;
164         }
165 
166         @DataClass.Generated.Member
setAuthorizationToken(@onNull String value)167         public @NonNull Builder setAuthorizationToken(@NonNull String value) {
168             checkNotUsed();
169             mBuilderFieldsSet |= 0x2;
170             mAuthorizationToken = value;
171             return this;
172         }
173 
174         @DataClass.Generated.Member
setCreationTime(@onNull long value)175         public @NonNull Builder setCreationTime(@NonNull long value) {
176             checkNotUsed();
177             mBuilderFieldsSet |= 0x4;
178             mCreationTime = value;
179             return this;
180         }
181 
182         @DataClass.Generated.Member
setExpiryTime(@onNull long value)183         public @NonNull Builder setExpiryTime(@NonNull long value) {
184             checkNotUsed();
185             mBuilderFieldsSet |= 0x8;
186             mExpiryTime = value;
187             return this;
188         }
189 
190         /** Builds the instance. This builder should not be touched after calling this! */
build()191         public @NonNull ODPAuthorizationToken build() {
192             checkNotUsed();
193             mBuilderFieldsSet |= 0x10; // Mark builder used
194 
195             ODPAuthorizationToken o = new ODPAuthorizationToken(
196                     mOwnerIdentifier,
197                     mAuthorizationToken,
198                     mCreationTime,
199                     mExpiryTime);
200             return o;
201         }
202 
checkNotUsed()203         private void checkNotUsed() {
204             if ((mBuilderFieldsSet & 0x10) != 0) {
205                 throw new IllegalStateException(
206                         "This Builder should not be reused. Use a new Builder instance instead");
207             }
208         }
209     }
210 
211     @DataClass.Generated(
212             time = 1705438009708L,
213             codegenVersion = "1.0.23",
214             sourceFile = "packages/modules/OnDevicePersonalization/federatedcompute/src/com/android/federatedcompute/services/data/ODPAuthorizationToken.java",
215             inputSignatures = "private final @android.annotation.NonNull java.lang.String mOwnerIdentifier\nprivate final @android.annotation.NonNull java.lang.String mAuthorizationToken\nprivate final @android.annotation.NonNull long mCreationTime\nprivate final @android.annotation.NonNull long mExpiryTime\nclass ODPAuthorizationToken extends java.lang.Object implements []\n@com.android.ondevicepersonalization.internal.util.DataClass(genHiddenBuilder=true, genEqualsHashCode=true)")
216     @Deprecated
__metadata()217     private void __metadata() {}
218 
219 
220     //@formatter:on
221     // End of generated code
222 
223 }
224