|
| 1 | +/* |
| 2 | + * Generated by https://github.com/killbill/api-pojos. Do not edit! |
| 3 | + * |
| 4 | + * Copyright 2022-2022 The Billing Project, LLC |
| 5 | + * |
| 6 | + * The Billing Project licenses this file to you under the Apache License, |
| 7 | + * version 2.0 (the "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at: |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 14 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 15 | + * License for the specific language governing permissions and limitations |
| 16 | + * under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +package org.killbill.billing.usage.plugin.api.boilerplate.plugin; |
| 20 | + |
| 21 | +import com.fasterxml.jackson.annotation.JsonGetter; |
| 22 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| 23 | +import java.util.Arrays; |
| 24 | +import java.util.Objects; |
| 25 | +import java.util.UUID; |
| 26 | +import org.joda.time.LocalDate; |
| 27 | +import org.killbill.billing.invoice.api.DryRunType; |
| 28 | +import org.killbill.billing.usage.plugin.api.UsageContext; |
| 29 | + |
| 30 | +@JsonDeserialize( builder = UsageContextImp.Builder.class ) |
| 31 | +public class UsageContextImp implements UsageContext { |
| 32 | + |
| 33 | + protected UUID accountId; |
| 34 | + protected DryRunType dryRunType; |
| 35 | + protected LocalDate inputTargetDate; |
| 36 | + protected UUID tenantId; |
| 37 | + |
| 38 | + public UsageContextImp(final UsageContextImp that) { |
| 39 | + this.accountId = that.accountId; |
| 40 | + this.dryRunType = that.dryRunType; |
| 41 | + this.inputTargetDate = that.inputTargetDate; |
| 42 | + this.tenantId = that.tenantId; |
| 43 | + } |
| 44 | + protected UsageContextImp(final UsageContextImp.Builder<?> builder) { |
| 45 | + this.accountId = builder.accountId; |
| 46 | + this.dryRunType = builder.dryRunType; |
| 47 | + this.inputTargetDate = builder.inputTargetDate; |
| 48 | + this.tenantId = builder.tenantId; |
| 49 | + } |
| 50 | + protected UsageContextImp() { } |
| 51 | + @Override |
| 52 | + public UUID getAccountId() { |
| 53 | + return this.accountId; |
| 54 | + } |
| 55 | + @Override |
| 56 | + public DryRunType getDryRunType() { |
| 57 | + return this.dryRunType; |
| 58 | + } |
| 59 | + @Override |
| 60 | + public LocalDate getInputTargetDate() { |
| 61 | + return this.inputTargetDate; |
| 62 | + } |
| 63 | + @Override |
| 64 | + public UUID getTenantId() { |
| 65 | + return this.tenantId; |
| 66 | + } |
| 67 | + @Override |
| 68 | + public boolean equals(final Object o) { |
| 69 | + if ( this == o ) { |
| 70 | + return true; |
| 71 | + } |
| 72 | + if ( ( o == null ) || ( this.getClass() != o.getClass() ) ) { |
| 73 | + return false; |
| 74 | + } |
| 75 | + final UsageContextImp that = (UsageContextImp) o; |
| 76 | + if( !Objects.equals(this.accountId, that.accountId) ) { |
| 77 | + return false; |
| 78 | + } |
| 79 | + if( !Objects.equals(this.dryRunType, that.dryRunType) ) { |
| 80 | + return false; |
| 81 | + } |
| 82 | + if( ( this.inputTargetDate != null ) ? ( 0 != this.inputTargetDate.compareTo(that.inputTargetDate) ) : ( that.inputTargetDate != null ) ) { |
| 83 | + return false; |
| 84 | + } |
| 85 | + if( !Objects.equals(this.tenantId, that.tenantId) ) { |
| 86 | + return false; |
| 87 | + } |
| 88 | + return true; |
| 89 | + } |
| 90 | + @Override |
| 91 | + public int hashCode() { |
| 92 | + int result = 1; |
| 93 | + result = ( 31 * result ) + Objects.hashCode(this.accountId); |
| 94 | + result = ( 31 * result ) + Objects.hashCode(this.dryRunType); |
| 95 | + result = ( 31 * result ) + Objects.hashCode(this.inputTargetDate); |
| 96 | + result = ( 31 * result ) + Objects.hashCode(this.tenantId); |
| 97 | + return result; |
| 98 | + } |
| 99 | + @Override |
| 100 | + public String toString() { |
| 101 | + final StringBuffer sb = new StringBuffer(this.getClass().getSimpleName()); |
| 102 | + sb.append("{"); |
| 103 | + sb.append("accountId=").append(this.accountId); |
| 104 | + sb.append(", "); |
| 105 | + sb.append("dryRunType=").append(this.dryRunType); |
| 106 | + sb.append(", "); |
| 107 | + sb.append("inputTargetDate=").append(this.inputTargetDate); |
| 108 | + sb.append(", "); |
| 109 | + sb.append("tenantId=").append(this.tenantId); |
| 110 | + sb.append("}"); |
| 111 | + return sb.toString(); |
| 112 | + } |
| 113 | + |
| 114 | + @SuppressWarnings("unchecked") |
| 115 | + public static class Builder<T extends UsageContextImp.Builder<T>> { |
| 116 | + |
| 117 | + protected UUID accountId; |
| 118 | + protected DryRunType dryRunType; |
| 119 | + protected LocalDate inputTargetDate; |
| 120 | + protected UUID tenantId; |
| 121 | + |
| 122 | + public Builder() { } |
| 123 | + public Builder(final Builder that) { |
| 124 | + this.accountId = that.accountId; |
| 125 | + this.dryRunType = that.dryRunType; |
| 126 | + this.inputTargetDate = that.inputTargetDate; |
| 127 | + this.tenantId = that.tenantId; |
| 128 | + } |
| 129 | + public T withAccountId(final UUID accountId) { |
| 130 | + this.accountId = accountId; |
| 131 | + return (T) this; |
| 132 | + } |
| 133 | + public T withDryRunType(final DryRunType dryRunType) { |
| 134 | + this.dryRunType = dryRunType; |
| 135 | + return (T) this; |
| 136 | + } |
| 137 | + public T withInputTargetDate(final LocalDate inputTargetDate) { |
| 138 | + this.inputTargetDate = inputTargetDate; |
| 139 | + return (T) this; |
| 140 | + } |
| 141 | + public T withTenantId(final UUID tenantId) { |
| 142 | + this.tenantId = tenantId; |
| 143 | + return (T) this; |
| 144 | + } |
| 145 | + public T source(final UsageContext that) { |
| 146 | + this.accountId = that.getAccountId(); |
| 147 | + this.dryRunType = that.getDryRunType(); |
| 148 | + this.inputTargetDate = that.getInputTargetDate(); |
| 149 | + this.tenantId = that.getTenantId(); |
| 150 | + return (T) this; |
| 151 | + } |
| 152 | + protected Builder validate() { |
| 153 | + return this; |
| 154 | + } |
| 155 | + public UsageContextImp build() { |
| 156 | + return new UsageContextImp(this.validate()); |
| 157 | + } |
| 158 | + } |
| 159 | +} |
0 commit comments