All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.killbill.billing.entitlement.api.boilerplate.EntitlementSpecifierImp Maven / Gradle / Ivy

/*
 *  Generated by https://github.com/killbill/api-pojos. Do not edit!
 *
 *  Copyright 2022-2022 The Billing Project, LLC
 *
 *  The Billing Project licenses this file to you under the Apache License,
 *  version 2.0 (the "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 *  License for the specific language governing permissions and limitations
 *  under the License.
 */

package org.killbill.billing.entitlement.api.boilerplate;

import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.killbill.billing.catalog.api.PlanPhasePriceOverride;
import org.killbill.billing.catalog.api.PlanPhaseSpecifier;
import org.killbill.billing.entitlement.api.EntitlementSpecifier;

@JsonDeserialize( builder = EntitlementSpecifierImp.Builder.class )
public class EntitlementSpecifierImp implements EntitlementSpecifier {

    protected Integer billCycleDay;
    protected String externalKey;
    protected List overrides;
    protected PlanPhaseSpecifier planPhaseSpecifier;
    protected Integer quantity;

    public EntitlementSpecifierImp(final EntitlementSpecifierImp that) {
        this.billCycleDay = that.billCycleDay;
        this.externalKey = that.externalKey;
        this.overrides = that.overrides;
        this.planPhaseSpecifier = that.planPhaseSpecifier;
        this.quantity = that.quantity;
    }
    protected EntitlementSpecifierImp(final EntitlementSpecifierImp.Builder builder) {
        this.billCycleDay = builder.billCycleDay;
        this.externalKey = builder.externalKey;
        this.overrides = builder.overrides;
        this.planPhaseSpecifier = builder.planPhaseSpecifier;
        this.quantity = builder.quantity;
    }
    protected EntitlementSpecifierImp() { }
    @Override
    public Integer getBillCycleDay() {
        return this.billCycleDay;
    }
    @Override
    public String getExternalKey() {
        return this.externalKey;
    }
    @Override
    public List getOverrides() {
        return this.overrides;
    }
    @Override
    public PlanPhaseSpecifier getPlanPhaseSpecifier() {
        return this.planPhaseSpecifier;
    }
    @Override
    public Integer getQuantity() {
        return this.quantity;
    }
    @Override
    public boolean equals(final Object o) {
        if ( this == o ) {
            return true;
        }
        if ( ( o == null ) || ( this.getClass() != o.getClass() ) ) {
            return false;
        }
        final EntitlementSpecifierImp that = (EntitlementSpecifierImp) o;
        if( !Objects.equals(this.billCycleDay, that.billCycleDay) ) {
            return false;
        }
        if( !Objects.equals(this.externalKey, that.externalKey) ) {
            return false;
        }
        if( !Objects.equals(this.overrides, that.overrides) ) {
            return false;
        }
        if( !Objects.equals(this.planPhaseSpecifier, that.planPhaseSpecifier) ) {
            return false;
        }
        if( !Objects.equals(this.quantity, that.quantity) ) {
            return false;
        }
        return true;
    }
    @Override
    public int hashCode() {
        int result = 1;
        result = ( 31 * result ) + Objects.hashCode(this.billCycleDay);
        result = ( 31 * result ) + Objects.hashCode(this.externalKey);
        result = ( 31 * result ) + Objects.hashCode(this.overrides);
        result = ( 31 * result ) + Objects.hashCode(this.planPhaseSpecifier);
        result = ( 31 * result ) + Objects.hashCode(this.quantity);
        return result;
    }
    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer(this.getClass().getSimpleName());
        sb.append("{");
        sb.append("billCycleDay=").append(this.billCycleDay);
        sb.append(", ");
        sb.append("externalKey=");
        if( this.externalKey == null ) {
            sb.append(this.externalKey);
        }else{
            sb.append("'").append(this.externalKey).append("'");
        }
        sb.append(", ");
        sb.append("overrides=").append(this.overrides);
        sb.append(", ");
        sb.append("planPhaseSpecifier=").append(this.planPhaseSpecifier);
        sb.append(", ");
        sb.append("quantity=").append(this.quantity);
        sb.append("}");
        return sb.toString();
    }

    @SuppressWarnings("unchecked")
    public static class Builder> {

        protected Integer billCycleDay;
        protected String externalKey;
        protected List overrides;
        protected PlanPhaseSpecifier planPhaseSpecifier;
        protected Integer quantity;

        public Builder() { }
        public Builder(final Builder that) {
            this.billCycleDay = that.billCycleDay;
            this.externalKey = that.externalKey;
            this.overrides = that.overrides;
            this.planPhaseSpecifier = that.planPhaseSpecifier;
            this.quantity = that.quantity;
        }
        public T withBillCycleDay(final Integer billCycleDay) {
            this.billCycleDay = billCycleDay;
            return (T) this;
        }
        public T withExternalKey(final String externalKey) {
            this.externalKey = externalKey;
            return (T) this;
        }
        public T withOverrides(final List overrides) {
            this.overrides = overrides;
            return (T) this;
        }
        public T withPlanPhaseSpecifier(final PlanPhaseSpecifier planPhaseSpecifier) {
            this.planPhaseSpecifier = planPhaseSpecifier;
            return (T) this;
        }
        public T withQuantity(final Integer quantity) {
            this.quantity = quantity;
            return (T) this;
        }
        public T source(final EntitlementSpecifier that) {
            this.billCycleDay = that.getBillCycleDay();
            this.externalKey = that.getExternalKey();
            this.overrides = that.getOverrides();
            this.planPhaseSpecifier = that.getPlanPhaseSpecifier();
            this.quantity = that.getQuantity();
            return (T) this;
        }
        protected Builder validate() {
          return this;
        }
        public EntitlementSpecifierImp build() {
            return new EntitlementSpecifierImp(this.validate());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy