1 /* 2 * Copyright (C) 2022 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.adservices.ondevicepersonalization; 18 19 import android.annotation.FlaggedApi; 20 import android.annotation.NonNull; 21 import android.annotation.Nullable; 22 23 import com.android.adservices.ondevicepersonalization.flags.Flags; 24 import com.android.ondevicepersonalization.internal.util.AnnotationValidations; 25 import com.android.ondevicepersonalization.internal.util.DataClass; 26 27 /** 28 * The input data for {@link 29 * IsolatedWorker#onDownloadCompleted(DownloadCompletedInput, android.os.OutcomeReceiver)}. 30 * 31 */ 32 @FlaggedApi(Flags.FLAG_ON_DEVICE_PERSONALIZATION_APIS_ENABLED) 33 @DataClass(genHiddenBuilder = true, genEqualsHashCode = true) 34 public final class DownloadCompletedInput { 35 /** 36 * A {@link KeyValueStore} that contains the downloaded content. 37 */ 38 @NonNull KeyValueStore mDownloadedContents; 39 40 41 42 // Code below generated by codegen v1.0.23. 43 // 44 // DO NOT MODIFY! 45 // CHECKSTYLE:OFF Generated code 46 // 47 // To regenerate run: 48 // $ codegen $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/DownloadCompletedInput.java 49 // 50 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 51 // Settings > Editor > Code Style > Formatter Control 52 //@formatter:off 53 54 55 @DataClass.Generated.Member DownloadCompletedInput( @onNull KeyValueStore downloadedContents)56 /* package-private */ DownloadCompletedInput( 57 @NonNull KeyValueStore downloadedContents) { 58 this.mDownloadedContents = downloadedContents; 59 AnnotationValidations.validate( 60 NonNull.class, null, mDownloadedContents); 61 62 // onConstructed(); // You can define this method to get a callback 63 } 64 65 /** 66 * Map containing downloaded keys and values 67 */ 68 @DataClass.Generated.Member getDownloadedContents()69 public @NonNull KeyValueStore getDownloadedContents() { 70 return mDownloadedContents; 71 } 72 73 @Override 74 @DataClass.Generated.Member equals(@ullable Object o)75 public boolean equals(@Nullable Object o) { 76 // You can override field equality logic by defining either of the methods like: 77 // boolean fieldNameEquals(DownloadCompletedInput other) { ... } 78 // boolean fieldNameEquals(FieldType otherValue) { ... } 79 80 if (this == o) return true; 81 if (o == null || getClass() != o.getClass()) return false; 82 @SuppressWarnings("unchecked") 83 DownloadCompletedInput that = (DownloadCompletedInput) o; 84 //noinspection PointlessBooleanExpression 85 return true 86 && java.util.Objects.equals(mDownloadedContents, that.mDownloadedContents); 87 } 88 89 @Override 90 @DataClass.Generated.Member hashCode()91 public int hashCode() { 92 // You can override field hashCode logic by defining methods like: 93 // int fieldNameHashCode() { ... } 94 95 int _hash = 1; 96 _hash = 31 * _hash + java.util.Objects.hashCode(mDownloadedContents); 97 return _hash; 98 } 99 100 /** 101 * A builder for {@link DownloadCompletedInput} 102 * @hide 103 */ 104 @SuppressWarnings("WeakerAccess") 105 @DataClass.Generated.Member 106 public static final class Builder { 107 108 private @NonNull KeyValueStore mDownloadedContents; 109 110 private long mBuilderFieldsSet = 0L; 111 Builder()112 public Builder() { 113 } 114 115 /** 116 * Creates a new Builder. 117 * 118 * @param downloadedContents 119 * Map containing downloaded keys and values 120 */ Builder( @onNull KeyValueStore downloadedContents)121 public Builder( 122 @NonNull KeyValueStore downloadedContents) { 123 mDownloadedContents = downloadedContents; 124 AnnotationValidations.validate( 125 NonNull.class, null, mDownloadedContents); 126 } 127 128 /** 129 * Map containing downloaded keys and values 130 */ 131 @DataClass.Generated.Member setDownloadedContents(@onNull KeyValueStore value)132 public @NonNull Builder setDownloadedContents(@NonNull KeyValueStore value) { 133 checkNotUsed(); 134 mBuilderFieldsSet |= 0x1; 135 mDownloadedContents = value; 136 return this; 137 } 138 139 /** Builds the instance. This builder should not be touched after calling this! */ build()140 public @NonNull DownloadCompletedInput build() { 141 checkNotUsed(); 142 mBuilderFieldsSet |= 0x2; // Mark builder used 143 144 DownloadCompletedInput o = new DownloadCompletedInput( 145 mDownloadedContents); 146 return o; 147 } 148 checkNotUsed()149 private void checkNotUsed() { 150 if ((mBuilderFieldsSet & 0x2) != 0) { 151 throw new IllegalStateException( 152 "This Builder should not be reused. Use a new Builder instance instead"); 153 } 154 } 155 } 156 157 @DataClass.Generated( 158 time = 1706205792643L, 159 codegenVersion = "1.0.23", 160 sourceFile = "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/DownloadCompletedInput.java", 161 inputSignatures = " @android.annotation.NonNull android.adservices.ondevicepersonalization.KeyValueStore mDownloadedContents\nclass DownloadCompletedInput extends java.lang.Object implements []\n@com.android.ondevicepersonalization.internal.util.DataClass(genHiddenBuilder=true, genEqualsHashCode=true)") 162 @Deprecated __metadata()163 private void __metadata() {} 164 165 166 //@formatter:on 167 // End of generated code 168 169 } 170