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.federatedcompute.common; 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 /** 25 * The request to schedule federated computation job. 26 * 27 * @hide 28 */ 29 @DataClass(genBuilder = true, genEqualsHashCode = true) 30 public class ScheduleFederatedComputeRequest { 31 @NonNull private final TrainingOptions mTrainingOptions; 32 33 // Code below generated by codegen v1.0.23. 34 // 35 // DO NOT MODIFY! 36 // CHECKSTYLE:OFF Generated code 37 // 38 // To regenerate run: 39 // $ codegen 40 // $ANDROID_BUILD_TOP/packages/modules/OnDevicePersonalization/framework/java/android/ondevicepersonalization/federatedcompute/ScheduleFederatedComputeRequest.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 @DataClass.Generated.Member ScheduleFederatedComputeRequest( @onNull TrainingOptions trainingOptions)47 /* package-private */ ScheduleFederatedComputeRequest( 48 @NonNull TrainingOptions trainingOptions) { 49 this.mTrainingOptions = trainingOptions; 50 AnnotationValidations.validate(NonNull.class, null, mTrainingOptions); 51 52 // onConstructed(); // You can define this method to get a callback 53 } 54 55 @DataClass.Generated.Member getTrainingOptions()56 public @NonNull TrainingOptions getTrainingOptions() { 57 return mTrainingOptions; 58 } 59 60 @Override 61 @DataClass.Generated.Member equals(@ndroid.annotation.Nullable Object o)62 public boolean equals(@android.annotation.Nullable Object o) { 63 // You can override field equality logic by defining either of the methods like: 64 // boolean fieldNameEquals(ScheduleFederatedComputeRequest other) { ... } 65 // boolean fieldNameEquals(FieldType otherValue) { ... } 66 67 if (this == o) return true; 68 if (o == null || getClass() != o.getClass()) return false; 69 @SuppressWarnings("unchecked") 70 ScheduleFederatedComputeRequest that = (ScheduleFederatedComputeRequest) o; 71 //noinspection PointlessBooleanExpression 72 return true && java.util.Objects.equals(mTrainingOptions, that.mTrainingOptions); 73 } 74 75 @Override 76 @DataClass.Generated.Member hashCode()77 public int hashCode() { 78 // You can override field hashCode logic by defining methods like: 79 // int fieldNameHashCode() { ... } 80 81 int _hash = 1; 82 _hash = 31 * _hash + java.util.Objects.hashCode(mTrainingOptions); 83 return _hash; 84 } 85 86 /** A builder for {@link ScheduleFederatedComputeRequest} */ 87 @SuppressWarnings("WeakerAccess") 88 @DataClass.Generated.Member 89 public static class Builder { 90 91 private @NonNull TrainingOptions mTrainingOptions; 92 93 private long mBuilderFieldsSet = 0L; 94 Builder()95 public Builder() {} 96 97 @DataClass.Generated.Member setTrainingOptions(@onNull TrainingOptions value)98 public @NonNull Builder setTrainingOptions(@NonNull TrainingOptions value) { 99 checkNotUsed(); 100 mBuilderFieldsSet |= 0x1; 101 mTrainingOptions = value; 102 return this; 103 } 104 105 /** Builds the instance. This builder should not be touched after calling this! */ build()106 public @NonNull ScheduleFederatedComputeRequest build() { 107 checkNotUsed(); 108 mBuilderFieldsSet |= 0x2; // Mark builder used 109 110 ScheduleFederatedComputeRequest o = 111 new ScheduleFederatedComputeRequest(mTrainingOptions); 112 return o; 113 } 114 checkNotUsed()115 private void checkNotUsed() { 116 if ((mBuilderFieldsSet & 0x2) != 0) { 117 throw new IllegalStateException( 118 "This Builder should not be reused. Use a new Builder instance instead"); 119 } 120 } 121 } 122 123 // @formatter:on 124 // End of generated code 125 126 } 127