Aurimas Liutikas | dc3f885 | 2024-07-11 10:07:48 -0700 | [diff] [blame^] | 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 | |
| 22 | import com.android.adservices.ondevicepersonalization.flags.Flags; |
| 23 | import com.android.ondevicepersonalization.internal.util.AnnotationValidations; |
| 24 | import com.android.ondevicepersonalization.internal.util.DataClass; |
| 25 | |
| 26 | /** The input data for {@link FederatedComputeScheduler#schedule}. */ |
| 27 | @DataClass(genBuilder = true, genEqualsHashCode = true) |
| 28 | @FlaggedApi(Flags.FLAG_ON_DEVICE_PERSONALIZATION_APIS_ENABLED) |
| 29 | public final class FederatedComputeInput { |
| 30 | // TODO(b/300461799): add federated compute server document. |
| 31 | /** |
| 32 | * Population refers to a collection of devices that specific task groups can run on. It should |
| 33 | * match task plan configured at remote federated compute server. |
| 34 | */ |
| 35 | @NonNull private String mPopulationName = ""; |
| 36 | |
| 37 | // Code below generated by codegen v1.0.23. |
| 38 | // |
| 39 | // DO NOT MODIFY! |
| 40 | // CHECKSTYLE:OFF Generated code |
| 41 | // |
| 42 | // To regenerate run: |
| 43 | // $ codegen |
| 44 | // $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/FederatedComputeInput.java |
| 45 | // |
| 46 | // To exclude the generated code from IntelliJ auto-formatting enable (one-time): |
| 47 | // Settings > Editor > Code Style > Formatter Control |
| 48 | // @formatter:off |
| 49 | |
| 50 | @DataClass.Generated.Member |
| 51 | /* package-private */ FederatedComputeInput(@NonNull String populationName) { |
| 52 | this.mPopulationName = populationName; |
| 53 | AnnotationValidations.validate(NonNull.class, null, mPopulationName); |
| 54 | |
| 55 | // onConstructed(); // You can define this method to get a callback |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Population refers to a collection of devices that specific task groups can run on. It should |
| 60 | * match task plan configured at remote federated compute server. |
| 61 | */ |
| 62 | @DataClass.Generated.Member |
| 63 | public @NonNull String getPopulationName() { |
| 64 | return mPopulationName; |
| 65 | } |
| 66 | |
| 67 | @Override |
| 68 | @DataClass.Generated.Member |
| 69 | public boolean equals(@android.annotation.Nullable Object o) { |
| 70 | // You can override field equality logic by defining either of the methods like: |
| 71 | // boolean fieldNameEquals(FederatedComputeInput other) { ... } |
| 72 | // boolean fieldNameEquals(FieldType otherValue) { ... } |
| 73 | |
| 74 | if (this == o) return true; |
| 75 | if (o == null || getClass() != o.getClass()) return false; |
| 76 | @SuppressWarnings("unchecked") |
| 77 | FederatedComputeInput that = (FederatedComputeInput) o; |
| 78 | //noinspection PointlessBooleanExpression |
| 79 | return true && java.util.Objects.equals(mPopulationName, that.mPopulationName); |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | @DataClass.Generated.Member |
| 84 | public int hashCode() { |
| 85 | // You can override field hashCode logic by defining methods like: |
| 86 | // int fieldNameHashCode() { ... } |
| 87 | |
| 88 | int _hash = 1; |
| 89 | _hash = 31 * _hash + java.util.Objects.hashCode(mPopulationName); |
| 90 | return _hash; |
| 91 | } |
| 92 | |
| 93 | /** A builder for {@link FederatedComputeInput} */ |
| 94 | @SuppressWarnings("WeakerAccess") |
| 95 | @DataClass.Generated.Member |
| 96 | public static final class Builder { |
| 97 | |
| 98 | private @NonNull String mPopulationName; |
| 99 | |
| 100 | private long mBuilderFieldsSet = 0L; |
| 101 | |
| 102 | public Builder() {} |
| 103 | |
| 104 | /** Setter for {@link #getPopulationName}. */ |
| 105 | @DataClass.Generated.Member |
| 106 | public @NonNull Builder setPopulationName(@NonNull String value) { |
| 107 | checkNotUsed(); |
| 108 | mBuilderFieldsSet |= 0x1; |
| 109 | mPopulationName = value; |
| 110 | return this; |
| 111 | } |
| 112 | |
| 113 | /** Builds the instance. This builder should not be touched after calling this! */ |
| 114 | public @NonNull FederatedComputeInput build() { |
| 115 | checkNotUsed(); |
| 116 | mBuilderFieldsSet |= 0x2; // Mark builder used |
| 117 | |
| 118 | if ((mBuilderFieldsSet & 0x1) == 0) { |
| 119 | mPopulationName = ""; |
| 120 | } |
| 121 | FederatedComputeInput o = new FederatedComputeInput(mPopulationName); |
| 122 | return o; |
| 123 | } |
| 124 | |
| 125 | private void checkNotUsed() { |
| 126 | if ((mBuilderFieldsSet & 0x2) != 0) { |
| 127 | throw new IllegalStateException( |
| 128 | "This Builder should not be reused. Use a new Builder instance instead"); |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | @DataClass.Generated( |
| 134 | time = 1697578140247L, |
| 135 | codegenVersion = "1.0.23", |
| 136 | sourceFile = |
| 137 | "packages/modules/OnDevicePersonalization/framework/java/android/adservices/ondevicepersonalization/FederatedComputeInput.java", |
| 138 | inputSignatures = |
| 139 | "private @android.annotation.NonNull java.lang.String mPopulationName\nclass FederatedComputeInput extends java.lang.Object implements []\n@com.android.ondevicepersonalization.internal.util.DataClass(genBuilder=true, genEqualsHashCode=true)") |
| 140 | @Deprecated |
| 141 | private void __metadata() {} |
| 142 | |
| 143 | // @formatter:on |
| 144 | // End of generated code |
| 145 | |
| 146 | } |