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