
io.opencannabis.schema.product.struct.SaleDescriptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
Java RPCAPI client for the Bloombox Cloud.
The newest version!
/*
* Copyright 2019, Momentum Ideas Co.
*
* Licensed 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.
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: structs/pricing/SaleDescriptor.proto
package io.opencannabis.schema.product.struct;
/**
*
* A description of the sale, the parameters to invoke the sale, its valid dates, and its type.
*
*
* Protobuf type {@code opencannabis.structs.pricing.SaleDescriptor}
*/
public final class SaleDescriptor extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:opencannabis.structs.pricing.SaleDescriptor)
SaleDescriptorOrBuilder {
private static final long serialVersionUID = 0L;
// Use SaleDescriptor.newBuilder() to construct.
private SaleDescriptor(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
super(builder);
}
private SaleDescriptor() {
type_ = 0;
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private SaleDescriptor(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 8: {
int rawValue = input.readEnum();
type_ = rawValue;
break;
}
case 18: {
io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder subBuilder = null;
if (effective_ != null) {
subBuilder = effective_.toBuilder();
}
effective_ = input.readMessage(io.opencannabis.schema.temporal.TemporalInstant.Instant.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(effective_);
effective_ = subBuilder.buildPartial();
}
break;
}
case 26: {
io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder subBuilder = null;
if (expiration_ != null) {
subBuilder = expiration_.toBuilder();
}
expiration_ = input.readMessage(io.opencannabis.schema.temporal.TemporalInstant.Instant.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(expiration_);
expiration_ = subBuilder.buildPartial();
}
break;
}
case 34: {
io.opencannabis.schema.product.struct.PercentageDiscount.Builder subBuilder = null;
if (saleCase_ == 4) {
subBuilder = ((io.opencannabis.schema.product.struct.PercentageDiscount) sale_).toBuilder();
}
sale_ =
input.readMessage(io.opencannabis.schema.product.struct.PercentageDiscount.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((io.opencannabis.schema.product.struct.PercentageDiscount) sale_);
sale_ = subBuilder.buildPartial();
}
saleCase_ = 4;
break;
}
case 42: {
io.opencannabis.schema.product.struct.BOGODiscount.Builder subBuilder = null;
if (saleCase_ == 5) {
subBuilder = ((io.opencannabis.schema.product.struct.BOGODiscount) sale_).toBuilder();
}
sale_ =
input.readMessage(io.opencannabis.schema.product.struct.BOGODiscount.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((io.opencannabis.schema.product.struct.BOGODiscount) sale_);
sale_ = subBuilder.buildPartial();
}
saleCase_ = 5;
break;
}
case 50: {
io.opencannabis.schema.product.struct.LoyaltyDiscount.Builder subBuilder = null;
if (saleCase_ == 6) {
subBuilder = ((io.opencannabis.schema.product.struct.LoyaltyDiscount) sale_).toBuilder();
}
sale_ =
input.readMessage(io.opencannabis.schema.product.struct.LoyaltyDiscount.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((io.opencannabis.schema.product.struct.LoyaltyDiscount) sale_);
sale_ = subBuilder.buildPartial();
}
saleCase_ = 6;
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.opencannabis.schema.product.struct.ProductDiscount.internal_static_opencannabis_structs_pricing_SaleDescriptor_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.opencannabis.schema.product.struct.ProductDiscount.internal_static_opencannabis_structs_pricing_SaleDescriptor_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.opencannabis.schema.product.struct.SaleDescriptor.class, io.opencannabis.schema.product.struct.SaleDescriptor.Builder.class);
}
private int saleCase_ = 0;
private java.lang.Object sale_;
public enum SaleCase
implements com.google.protobuf.Internal.EnumLite {
PERCENTAGE_OFF(4),
BOGO(5),
LOYALTY(6),
SALE_NOT_SET(0);
private final int value;
private SaleCase(int value) {
this.value = value;
}
/**
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static SaleCase valueOf(int value) {
return forNumber(value);
}
public static SaleCase forNumber(int value) {
switch (value) {
case 4: return PERCENTAGE_OFF;
case 5: return BOGO;
case 6: return LOYALTY;
case 0: return SALE_NOT_SET;
default: return null;
}
}
public int getNumber() {
return this.value;
}
};
public SaleCase
getSaleCase() {
return SaleCase.forNumber(
saleCase_);
}
public static final int TYPE_FIELD_NUMBER = 1;
private int type_;
/**
*
* Sale metadata.
*
*
* .opencannabis.structs.pricing.SaleType type = 1;
*/
public int getTypeValue() {
return type_;
}
/**
*
* Sale metadata.
*
*
* .opencannabis.structs.pricing.SaleType type = 1;
*/
public io.opencannabis.schema.product.struct.SaleType getType() {
@SuppressWarnings("deprecation")
io.opencannabis.schema.product.struct.SaleType result = io.opencannabis.schema.product.struct.SaleType.valueOf(type_);
return result == null ? io.opencannabis.schema.product.struct.SaleType.UNRECOGNIZED : result;
}
public static final int EFFECTIVE_FIELD_NUMBER = 2;
private io.opencannabis.schema.temporal.TemporalInstant.Instant effective_;
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public boolean hasEffective() {
return effective_ != null;
}
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public io.opencannabis.schema.temporal.TemporalInstant.Instant getEffective() {
return effective_ == null ? io.opencannabis.schema.temporal.TemporalInstant.Instant.getDefaultInstance() : effective_;
}
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public io.opencannabis.schema.temporal.TemporalInstant.InstantOrBuilder getEffectiveOrBuilder() {
return getEffective();
}
public static final int EXPIRATION_FIELD_NUMBER = 3;
private io.opencannabis.schema.temporal.TemporalInstant.Instant expiration_;
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public boolean hasExpiration() {
return expiration_ != null;
}
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public io.opencannabis.schema.temporal.TemporalInstant.Instant getExpiration() {
return expiration_ == null ? io.opencannabis.schema.temporal.TemporalInstant.Instant.getDefaultInstance() : expiration_;
}
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public io.opencannabis.schema.temporal.TemporalInstant.InstantOrBuilder getExpirationOrBuilder() {
return getExpiration();
}
public static final int PERCENTAGE_OFF_FIELD_NUMBER = 4;
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public boolean hasPercentageOff() {
return saleCase_ == 4;
}
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public io.opencannabis.schema.product.struct.PercentageDiscount getPercentageOff() {
if (saleCase_ == 4) {
return (io.opencannabis.schema.product.struct.PercentageDiscount) sale_;
}
return io.opencannabis.schema.product.struct.PercentageDiscount.getDefaultInstance();
}
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public io.opencannabis.schema.product.struct.PercentageDiscountOrBuilder getPercentageOffOrBuilder() {
if (saleCase_ == 4) {
return (io.opencannabis.schema.product.struct.PercentageDiscount) sale_;
}
return io.opencannabis.schema.product.struct.PercentageDiscount.getDefaultInstance();
}
public static final int BOGO_FIELD_NUMBER = 5;
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public boolean hasBogo() {
return saleCase_ == 5;
}
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public io.opencannabis.schema.product.struct.BOGODiscount getBogo() {
if (saleCase_ == 5) {
return (io.opencannabis.schema.product.struct.BOGODiscount) sale_;
}
return io.opencannabis.schema.product.struct.BOGODiscount.getDefaultInstance();
}
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public io.opencannabis.schema.product.struct.BOGODiscountOrBuilder getBogoOrBuilder() {
if (saleCase_ == 5) {
return (io.opencannabis.schema.product.struct.BOGODiscount) sale_;
}
return io.opencannabis.schema.product.struct.BOGODiscount.getDefaultInstance();
}
public static final int LOYALTY_FIELD_NUMBER = 6;
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public boolean hasLoyalty() {
return saleCase_ == 6;
}
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public io.opencannabis.schema.product.struct.LoyaltyDiscount getLoyalty() {
if (saleCase_ == 6) {
return (io.opencannabis.schema.product.struct.LoyaltyDiscount) sale_;
}
return io.opencannabis.schema.product.struct.LoyaltyDiscount.getDefaultInstance();
}
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public io.opencannabis.schema.product.struct.LoyaltyDiscountOrBuilder getLoyaltyOrBuilder() {
if (saleCase_ == 6) {
return (io.opencannabis.schema.product.struct.LoyaltyDiscount) sale_;
}
return io.opencannabis.schema.product.struct.LoyaltyDiscount.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (type_ != io.opencannabis.schema.product.struct.SaleType.PERCENTAGE_REDUCTION.getNumber()) {
output.writeEnum(1, type_);
}
if (effective_ != null) {
output.writeMessage(2, getEffective());
}
if (expiration_ != null) {
output.writeMessage(3, getExpiration());
}
if (saleCase_ == 4) {
output.writeMessage(4, (io.opencannabis.schema.product.struct.PercentageDiscount) sale_);
}
if (saleCase_ == 5) {
output.writeMessage(5, (io.opencannabis.schema.product.struct.BOGODiscount) sale_);
}
if (saleCase_ == 6) {
output.writeMessage(6, (io.opencannabis.schema.product.struct.LoyaltyDiscount) sale_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (type_ != io.opencannabis.schema.product.struct.SaleType.PERCENTAGE_REDUCTION.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(1, type_);
}
if (effective_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, getEffective());
}
if (expiration_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, getExpiration());
}
if (saleCase_ == 4) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(4, (io.opencannabis.schema.product.struct.PercentageDiscount) sale_);
}
if (saleCase_ == 5) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(5, (io.opencannabis.schema.product.struct.BOGODiscount) sale_);
}
if (saleCase_ == 6) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(6, (io.opencannabis.schema.product.struct.LoyaltyDiscount) sale_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof io.opencannabis.schema.product.struct.SaleDescriptor)) {
return super.equals(obj);
}
io.opencannabis.schema.product.struct.SaleDescriptor other = (io.opencannabis.schema.product.struct.SaleDescriptor) obj;
if (type_ != other.type_) return false;
if (hasEffective() != other.hasEffective()) return false;
if (hasEffective()) {
if (!getEffective()
.equals(other.getEffective())) return false;
}
if (hasExpiration() != other.hasExpiration()) return false;
if (hasExpiration()) {
if (!getExpiration()
.equals(other.getExpiration())) return false;
}
if (!getSaleCase().equals(other.getSaleCase())) return false;
switch (saleCase_) {
case 4:
if (!getPercentageOff()
.equals(other.getPercentageOff())) return false;
break;
case 5:
if (!getBogo()
.equals(other.getBogo())) return false;
break;
case 6:
if (!getLoyalty()
.equals(other.getLoyalty())) return false;
break;
case 0:
default:
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + TYPE_FIELD_NUMBER;
hash = (53 * hash) + type_;
if (hasEffective()) {
hash = (37 * hash) + EFFECTIVE_FIELD_NUMBER;
hash = (53 * hash) + getEffective().hashCode();
}
if (hasExpiration()) {
hash = (37 * hash) + EXPIRATION_FIELD_NUMBER;
hash = (53 * hash) + getExpiration().hashCode();
}
switch (saleCase_) {
case 4:
hash = (37 * hash) + PERCENTAGE_OFF_FIELD_NUMBER;
hash = (53 * hash) + getPercentageOff().hashCode();
break;
case 5:
hash = (37 * hash) + BOGO_FIELD_NUMBER;
hash = (53 * hash) + getBogo().hashCode();
break;
case 6:
hash = (37 * hash) + LOYALTY_FIELD_NUMBER;
hash = (53 * hash) + getLoyalty().hashCode();
break;
case 0:
default:
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static io.opencannabis.schema.product.struct.SaleDescriptor parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(io.opencannabis.schema.product.struct.SaleDescriptor prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
* A description of the sale, the parameters to invoke the sale, its valid dates, and its type.
*
*
* Protobuf type {@code opencannabis.structs.pricing.SaleDescriptor}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder implements
// @@protoc_insertion_point(builder_implements:opencannabis.structs.pricing.SaleDescriptor)
io.opencannabis.schema.product.struct.SaleDescriptorOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return io.opencannabis.schema.product.struct.ProductDiscount.internal_static_opencannabis_structs_pricing_SaleDescriptor_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return io.opencannabis.schema.product.struct.ProductDiscount.internal_static_opencannabis_structs_pricing_SaleDescriptor_fieldAccessorTable
.ensureFieldAccessorsInitialized(
io.opencannabis.schema.product.struct.SaleDescriptor.class, io.opencannabis.schema.product.struct.SaleDescriptor.Builder.class);
}
// Construct using io.opencannabis.schema.product.struct.SaleDescriptor.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
type_ = 0;
if (effectiveBuilder_ == null) {
effective_ = null;
} else {
effective_ = null;
effectiveBuilder_ = null;
}
if (expirationBuilder_ == null) {
expiration_ = null;
} else {
expiration_ = null;
expirationBuilder_ = null;
}
saleCase_ = 0;
sale_ = null;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return io.opencannabis.schema.product.struct.ProductDiscount.internal_static_opencannabis_structs_pricing_SaleDescriptor_descriptor;
}
@java.lang.Override
public io.opencannabis.schema.product.struct.SaleDescriptor getDefaultInstanceForType() {
return io.opencannabis.schema.product.struct.SaleDescriptor.getDefaultInstance();
}
@java.lang.Override
public io.opencannabis.schema.product.struct.SaleDescriptor build() {
io.opencannabis.schema.product.struct.SaleDescriptor result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public io.opencannabis.schema.product.struct.SaleDescriptor buildPartial() {
io.opencannabis.schema.product.struct.SaleDescriptor result = new io.opencannabis.schema.product.struct.SaleDescriptor(this);
result.type_ = type_;
if (effectiveBuilder_ == null) {
result.effective_ = effective_;
} else {
result.effective_ = effectiveBuilder_.build();
}
if (expirationBuilder_ == null) {
result.expiration_ = expiration_;
} else {
result.expiration_ = expirationBuilder_.build();
}
if (saleCase_ == 4) {
if (percentageOffBuilder_ == null) {
result.sale_ = sale_;
} else {
result.sale_ = percentageOffBuilder_.build();
}
}
if (saleCase_ == 5) {
if (bogoBuilder_ == null) {
result.sale_ = sale_;
} else {
result.sale_ = bogoBuilder_.build();
}
}
if (saleCase_ == 6) {
if (loyaltyBuilder_ == null) {
result.sale_ = sale_;
} else {
result.sale_ = loyaltyBuilder_.build();
}
}
result.saleCase_ = saleCase_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof io.opencannabis.schema.product.struct.SaleDescriptor) {
return mergeFrom((io.opencannabis.schema.product.struct.SaleDescriptor)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(io.opencannabis.schema.product.struct.SaleDescriptor other) {
if (other == io.opencannabis.schema.product.struct.SaleDescriptor.getDefaultInstance()) return this;
if (other.type_ != 0) {
setTypeValue(other.getTypeValue());
}
if (other.hasEffective()) {
mergeEffective(other.getEffective());
}
if (other.hasExpiration()) {
mergeExpiration(other.getExpiration());
}
switch (other.getSaleCase()) {
case PERCENTAGE_OFF: {
mergePercentageOff(other.getPercentageOff());
break;
}
case BOGO: {
mergeBogo(other.getBogo());
break;
}
case LOYALTY: {
mergeLoyalty(other.getLoyalty());
break;
}
case SALE_NOT_SET: {
break;
}
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
io.opencannabis.schema.product.struct.SaleDescriptor parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (io.opencannabis.schema.product.struct.SaleDescriptor) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int saleCase_ = 0;
private java.lang.Object sale_;
public SaleCase
getSaleCase() {
return SaleCase.forNumber(
saleCase_);
}
public Builder clearSale() {
saleCase_ = 0;
sale_ = null;
onChanged();
return this;
}
private int type_ = 0;
/**
*
* Sale metadata.
*
*
* .opencannabis.structs.pricing.SaleType type = 1;
*/
public int getTypeValue() {
return type_;
}
/**
*
* Sale metadata.
*
*
* .opencannabis.structs.pricing.SaleType type = 1;
*/
public Builder setTypeValue(int value) {
type_ = value;
onChanged();
return this;
}
/**
*
* Sale metadata.
*
*
* .opencannabis.structs.pricing.SaleType type = 1;
*/
public io.opencannabis.schema.product.struct.SaleType getType() {
@SuppressWarnings("deprecation")
io.opencannabis.schema.product.struct.SaleType result = io.opencannabis.schema.product.struct.SaleType.valueOf(type_);
return result == null ? io.opencannabis.schema.product.struct.SaleType.UNRECOGNIZED : result;
}
/**
*
* Sale metadata.
*
*
* .opencannabis.structs.pricing.SaleType type = 1;
*/
public Builder setType(io.opencannabis.schema.product.struct.SaleType value) {
if (value == null) {
throw new NullPointerException();
}
type_ = value.getNumber();
onChanged();
return this;
}
/**
*
* Sale metadata.
*
*
* .opencannabis.structs.pricing.SaleType type = 1;
*/
public Builder clearType() {
type_ = 0;
onChanged();
return this;
}
private io.opencannabis.schema.temporal.TemporalInstant.Instant effective_;
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.temporal.TemporalInstant.Instant, io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder, io.opencannabis.schema.temporal.TemporalInstant.InstantOrBuilder> effectiveBuilder_;
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public boolean hasEffective() {
return effectiveBuilder_ != null || effective_ != null;
}
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public io.opencannabis.schema.temporal.TemporalInstant.Instant getEffective() {
if (effectiveBuilder_ == null) {
return effective_ == null ? io.opencannabis.schema.temporal.TemporalInstant.Instant.getDefaultInstance() : effective_;
} else {
return effectiveBuilder_.getMessage();
}
}
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public Builder setEffective(io.opencannabis.schema.temporal.TemporalInstant.Instant value) {
if (effectiveBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
effective_ = value;
onChanged();
} else {
effectiveBuilder_.setMessage(value);
}
return this;
}
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public Builder setEffective(
io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder builderForValue) {
if (effectiveBuilder_ == null) {
effective_ = builderForValue.build();
onChanged();
} else {
effectiveBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public Builder mergeEffective(io.opencannabis.schema.temporal.TemporalInstant.Instant value) {
if (effectiveBuilder_ == null) {
if (effective_ != null) {
effective_ =
io.opencannabis.schema.temporal.TemporalInstant.Instant.newBuilder(effective_).mergeFrom(value).buildPartial();
} else {
effective_ = value;
}
onChanged();
} else {
effectiveBuilder_.mergeFrom(value);
}
return this;
}
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public Builder clearEffective() {
if (effectiveBuilder_ == null) {
effective_ = null;
onChanged();
} else {
effective_ = null;
effectiveBuilder_ = null;
}
return this;
}
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder getEffectiveBuilder() {
onChanged();
return getEffectiveFieldBuilder().getBuilder();
}
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
public io.opencannabis.schema.temporal.TemporalInstant.InstantOrBuilder getEffectiveOrBuilder() {
if (effectiveBuilder_ != null) {
return effectiveBuilder_.getMessageOrBuilder();
} else {
return effective_ == null ?
io.opencannabis.schema.temporal.TemporalInstant.Instant.getDefaultInstance() : effective_;
}
}
/**
*
* Represents the date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant effective = 2;
*/
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.temporal.TemporalInstant.Instant, io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder, io.opencannabis.schema.temporal.TemporalInstant.InstantOrBuilder>
getEffectiveFieldBuilder() {
if (effectiveBuilder_ == null) {
effectiveBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.temporal.TemporalInstant.Instant, io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder, io.opencannabis.schema.temporal.TemporalInstant.InstantOrBuilder>(
getEffective(),
getParentForChildren(),
isClean());
effective_ = null;
}
return effectiveBuilder_;
}
private io.opencannabis.schema.temporal.TemporalInstant.Instant expiration_;
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.temporal.TemporalInstant.Instant, io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder, io.opencannabis.schema.temporal.TemporalInstant.InstantOrBuilder> expirationBuilder_;
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public boolean hasExpiration() {
return expirationBuilder_ != null || expiration_ != null;
}
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public io.opencannabis.schema.temporal.TemporalInstant.Instant getExpiration() {
if (expirationBuilder_ == null) {
return expiration_ == null ? io.opencannabis.schema.temporal.TemporalInstant.Instant.getDefaultInstance() : expiration_;
} else {
return expirationBuilder_.getMessage();
}
}
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public Builder setExpiration(io.opencannabis.schema.temporal.TemporalInstant.Instant value) {
if (expirationBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
expiration_ = value;
onChanged();
} else {
expirationBuilder_.setMessage(value);
}
return this;
}
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public Builder setExpiration(
io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder builderForValue) {
if (expirationBuilder_ == null) {
expiration_ = builderForValue.build();
onChanged();
} else {
expirationBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public Builder mergeExpiration(io.opencannabis.schema.temporal.TemporalInstant.Instant value) {
if (expirationBuilder_ == null) {
if (expiration_ != null) {
expiration_ =
io.opencannabis.schema.temporal.TemporalInstant.Instant.newBuilder(expiration_).mergeFrom(value).buildPartial();
} else {
expiration_ = value;
}
onChanged();
} else {
expirationBuilder_.mergeFrom(value);
}
return this;
}
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public Builder clearExpiration() {
if (expirationBuilder_ == null) {
expiration_ = null;
onChanged();
} else {
expiration_ = null;
expirationBuilder_ = null;
}
return this;
}
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder getExpirationBuilder() {
onChanged();
return getExpirationFieldBuilder().getBuilder();
}
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
public io.opencannabis.schema.temporal.TemporalInstant.InstantOrBuilder getExpirationOrBuilder() {
if (expirationBuilder_ != null) {
return expirationBuilder_.getMessageOrBuilder();
} else {
return expiration_ == null ?
io.opencannabis.schema.temporal.TemporalInstant.Instant.getDefaultInstance() : expiration_;
}
}
/**
*
* Represents the final date that the discount can be applied.
*
*
* .opencannabis.temporal.Instant expiration = 3;
*/
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.temporal.TemporalInstant.Instant, io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder, io.opencannabis.schema.temporal.TemporalInstant.InstantOrBuilder>
getExpirationFieldBuilder() {
if (expirationBuilder_ == null) {
expirationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.temporal.TemporalInstant.Instant, io.opencannabis.schema.temporal.TemporalInstant.Instant.Builder, io.opencannabis.schema.temporal.TemporalInstant.InstantOrBuilder>(
getExpiration(),
getParentForChildren(),
isClean());
expiration_ = null;
}
return expirationBuilder_;
}
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.product.struct.PercentageDiscount, io.opencannabis.schema.product.struct.PercentageDiscount.Builder, io.opencannabis.schema.product.struct.PercentageDiscountOrBuilder> percentageOffBuilder_;
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public boolean hasPercentageOff() {
return saleCase_ == 4;
}
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public io.opencannabis.schema.product.struct.PercentageDiscount getPercentageOff() {
if (percentageOffBuilder_ == null) {
if (saleCase_ == 4) {
return (io.opencannabis.schema.product.struct.PercentageDiscount) sale_;
}
return io.opencannabis.schema.product.struct.PercentageDiscount.getDefaultInstance();
} else {
if (saleCase_ == 4) {
return percentageOffBuilder_.getMessage();
}
return io.opencannabis.schema.product.struct.PercentageDiscount.getDefaultInstance();
}
}
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public Builder setPercentageOff(io.opencannabis.schema.product.struct.PercentageDiscount value) {
if (percentageOffBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
sale_ = value;
onChanged();
} else {
percentageOffBuilder_.setMessage(value);
}
saleCase_ = 4;
return this;
}
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public Builder setPercentageOff(
io.opencannabis.schema.product.struct.PercentageDiscount.Builder builderForValue) {
if (percentageOffBuilder_ == null) {
sale_ = builderForValue.build();
onChanged();
} else {
percentageOffBuilder_.setMessage(builderForValue.build());
}
saleCase_ = 4;
return this;
}
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public Builder mergePercentageOff(io.opencannabis.schema.product.struct.PercentageDiscount value) {
if (percentageOffBuilder_ == null) {
if (saleCase_ == 4 &&
sale_ != io.opencannabis.schema.product.struct.PercentageDiscount.getDefaultInstance()) {
sale_ = io.opencannabis.schema.product.struct.PercentageDiscount.newBuilder((io.opencannabis.schema.product.struct.PercentageDiscount) sale_)
.mergeFrom(value).buildPartial();
} else {
sale_ = value;
}
onChanged();
} else {
if (saleCase_ == 4) {
percentageOffBuilder_.mergeFrom(value);
}
percentageOffBuilder_.setMessage(value);
}
saleCase_ = 4;
return this;
}
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public Builder clearPercentageOff() {
if (percentageOffBuilder_ == null) {
if (saleCase_ == 4) {
saleCase_ = 0;
sale_ = null;
onChanged();
}
} else {
if (saleCase_ == 4) {
saleCase_ = 0;
sale_ = null;
}
percentageOffBuilder_.clear();
}
return this;
}
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public io.opencannabis.schema.product.struct.PercentageDiscount.Builder getPercentageOffBuilder() {
return getPercentageOffFieldBuilder().getBuilder();
}
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
public io.opencannabis.schema.product.struct.PercentageDiscountOrBuilder getPercentageOffOrBuilder() {
if ((saleCase_ == 4) && (percentageOffBuilder_ != null)) {
return percentageOffBuilder_.getMessageOrBuilder();
} else {
if (saleCase_ == 4) {
return (io.opencannabis.schema.product.struct.PercentageDiscount) sale_;
}
return io.opencannabis.schema.product.struct.PercentageDiscount.getDefaultInstance();
}
}
/**
*
* Represents the percentage value to be discounted.
*
*
* .opencannabis.structs.pricing.PercentageDiscount percentage_off = 4;
*/
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.product.struct.PercentageDiscount, io.opencannabis.schema.product.struct.PercentageDiscount.Builder, io.opencannabis.schema.product.struct.PercentageDiscountOrBuilder>
getPercentageOffFieldBuilder() {
if (percentageOffBuilder_ == null) {
if (!(saleCase_ == 4)) {
sale_ = io.opencannabis.schema.product.struct.PercentageDiscount.getDefaultInstance();
}
percentageOffBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.product.struct.PercentageDiscount, io.opencannabis.schema.product.struct.PercentageDiscount.Builder, io.opencannabis.schema.product.struct.PercentageDiscountOrBuilder>(
(io.opencannabis.schema.product.struct.PercentageDiscount) sale_,
getParentForChildren(),
isClean());
sale_ = null;
}
saleCase_ = 4;
onChanged();;
return percentageOffBuilder_;
}
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.product.struct.BOGODiscount, io.opencannabis.schema.product.struct.BOGODiscount.Builder, io.opencannabis.schema.product.struct.BOGODiscountOrBuilder> bogoBuilder_;
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public boolean hasBogo() {
return saleCase_ == 5;
}
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public io.opencannabis.schema.product.struct.BOGODiscount getBogo() {
if (bogoBuilder_ == null) {
if (saleCase_ == 5) {
return (io.opencannabis.schema.product.struct.BOGODiscount) sale_;
}
return io.opencannabis.schema.product.struct.BOGODiscount.getDefaultInstance();
} else {
if (saleCase_ == 5) {
return bogoBuilder_.getMessage();
}
return io.opencannabis.schema.product.struct.BOGODiscount.getDefaultInstance();
}
}
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public Builder setBogo(io.opencannabis.schema.product.struct.BOGODiscount value) {
if (bogoBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
sale_ = value;
onChanged();
} else {
bogoBuilder_.setMessage(value);
}
saleCase_ = 5;
return this;
}
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public Builder setBogo(
io.opencannabis.schema.product.struct.BOGODiscount.Builder builderForValue) {
if (bogoBuilder_ == null) {
sale_ = builderForValue.build();
onChanged();
} else {
bogoBuilder_.setMessage(builderForValue.build());
}
saleCase_ = 5;
return this;
}
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public Builder mergeBogo(io.opencannabis.schema.product.struct.BOGODiscount value) {
if (bogoBuilder_ == null) {
if (saleCase_ == 5 &&
sale_ != io.opencannabis.schema.product.struct.BOGODiscount.getDefaultInstance()) {
sale_ = io.opencannabis.schema.product.struct.BOGODiscount.newBuilder((io.opencannabis.schema.product.struct.BOGODiscount) sale_)
.mergeFrom(value).buildPartial();
} else {
sale_ = value;
}
onChanged();
} else {
if (saleCase_ == 5) {
bogoBuilder_.mergeFrom(value);
}
bogoBuilder_.setMessage(value);
}
saleCase_ = 5;
return this;
}
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public Builder clearBogo() {
if (bogoBuilder_ == null) {
if (saleCase_ == 5) {
saleCase_ = 0;
sale_ = null;
onChanged();
}
} else {
if (saleCase_ == 5) {
saleCase_ = 0;
sale_ = null;
}
bogoBuilder_.clear();
}
return this;
}
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public io.opencannabis.schema.product.struct.BOGODiscount.Builder getBogoBuilder() {
return getBogoFieldBuilder().getBuilder();
}
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
public io.opencannabis.schema.product.struct.BOGODiscountOrBuilder getBogoOrBuilder() {
if ((saleCase_ == 5) && (bogoBuilder_ != null)) {
return bogoBuilder_.getMessageOrBuilder();
} else {
if (saleCase_ == 5) {
return (io.opencannabis.schema.product.struct.BOGODiscount) sale_;
}
return io.opencannabis.schema.product.struct.BOGODiscount.getDefaultInstance();
}
}
/**
*
* Represents that the discount is buy one get one.
*
*
* .opencannabis.structs.pricing.BOGODiscount bogo = 5;
*/
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.product.struct.BOGODiscount, io.opencannabis.schema.product.struct.BOGODiscount.Builder, io.opencannabis.schema.product.struct.BOGODiscountOrBuilder>
getBogoFieldBuilder() {
if (bogoBuilder_ == null) {
if (!(saleCase_ == 5)) {
sale_ = io.opencannabis.schema.product.struct.BOGODiscount.getDefaultInstance();
}
bogoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.product.struct.BOGODiscount, io.opencannabis.schema.product.struct.BOGODiscount.Builder, io.opencannabis.schema.product.struct.BOGODiscountOrBuilder>(
(io.opencannabis.schema.product.struct.BOGODiscount) sale_,
getParentForChildren(),
isClean());
sale_ = null;
}
saleCase_ = 5;
onChanged();;
return bogoBuilder_;
}
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.product.struct.LoyaltyDiscount, io.opencannabis.schema.product.struct.LoyaltyDiscount.Builder, io.opencannabis.schema.product.struct.LoyaltyDiscountOrBuilder> loyaltyBuilder_;
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public boolean hasLoyalty() {
return saleCase_ == 6;
}
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public io.opencannabis.schema.product.struct.LoyaltyDiscount getLoyalty() {
if (loyaltyBuilder_ == null) {
if (saleCase_ == 6) {
return (io.opencannabis.schema.product.struct.LoyaltyDiscount) sale_;
}
return io.opencannabis.schema.product.struct.LoyaltyDiscount.getDefaultInstance();
} else {
if (saleCase_ == 6) {
return loyaltyBuilder_.getMessage();
}
return io.opencannabis.schema.product.struct.LoyaltyDiscount.getDefaultInstance();
}
}
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public Builder setLoyalty(io.opencannabis.schema.product.struct.LoyaltyDiscount value) {
if (loyaltyBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
sale_ = value;
onChanged();
} else {
loyaltyBuilder_.setMessage(value);
}
saleCase_ = 6;
return this;
}
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public Builder setLoyalty(
io.opencannabis.schema.product.struct.LoyaltyDiscount.Builder builderForValue) {
if (loyaltyBuilder_ == null) {
sale_ = builderForValue.build();
onChanged();
} else {
loyaltyBuilder_.setMessage(builderForValue.build());
}
saleCase_ = 6;
return this;
}
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public Builder mergeLoyalty(io.opencannabis.schema.product.struct.LoyaltyDiscount value) {
if (loyaltyBuilder_ == null) {
if (saleCase_ == 6 &&
sale_ != io.opencannabis.schema.product.struct.LoyaltyDiscount.getDefaultInstance()) {
sale_ = io.opencannabis.schema.product.struct.LoyaltyDiscount.newBuilder((io.opencannabis.schema.product.struct.LoyaltyDiscount) sale_)
.mergeFrom(value).buildPartial();
} else {
sale_ = value;
}
onChanged();
} else {
if (saleCase_ == 6) {
loyaltyBuilder_.mergeFrom(value);
}
loyaltyBuilder_.setMessage(value);
}
saleCase_ = 6;
return this;
}
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public Builder clearLoyalty() {
if (loyaltyBuilder_ == null) {
if (saleCase_ == 6) {
saleCase_ = 0;
sale_ = null;
onChanged();
}
} else {
if (saleCase_ == 6) {
saleCase_ = 0;
sale_ = null;
}
loyaltyBuilder_.clear();
}
return this;
}
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public io.opencannabis.schema.product.struct.LoyaltyDiscount.Builder getLoyaltyBuilder() {
return getLoyaltyFieldBuilder().getBuilder();
}
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
public io.opencannabis.schema.product.struct.LoyaltyDiscountOrBuilder getLoyaltyOrBuilder() {
if ((saleCase_ == 6) && (loyaltyBuilder_ != null)) {
return loyaltyBuilder_.getMessageOrBuilder();
} else {
if (saleCase_ == 6) {
return (io.opencannabis.schema.product.struct.LoyaltyDiscount) sale_;
}
return io.opencannabis.schema.product.struct.LoyaltyDiscount.getDefaultInstance();
}
}
/**
*
* Represents that the discount is using accrued loyalty rewards.
*
*
* .opencannabis.structs.pricing.LoyaltyDiscount loyalty = 6;
*/
private com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.product.struct.LoyaltyDiscount, io.opencannabis.schema.product.struct.LoyaltyDiscount.Builder, io.opencannabis.schema.product.struct.LoyaltyDiscountOrBuilder>
getLoyaltyFieldBuilder() {
if (loyaltyBuilder_ == null) {
if (!(saleCase_ == 6)) {
sale_ = io.opencannabis.schema.product.struct.LoyaltyDiscount.getDefaultInstance();
}
loyaltyBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
io.opencannabis.schema.product.struct.LoyaltyDiscount, io.opencannabis.schema.product.struct.LoyaltyDiscount.Builder, io.opencannabis.schema.product.struct.LoyaltyDiscountOrBuilder>(
(io.opencannabis.schema.product.struct.LoyaltyDiscount) sale_,
getParentForChildren(),
isClean());
sale_ = null;
}
saleCase_ = 6;
onChanged();;
return loyaltyBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:opencannabis.structs.pricing.SaleDescriptor)
}
// @@protoc_insertion_point(class_scope:opencannabis.structs.pricing.SaleDescriptor)
private static final io.opencannabis.schema.product.struct.SaleDescriptor DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new io.opencannabis.schema.product.struct.SaleDescriptor();
}
public static io.opencannabis.schema.product.struct.SaleDescriptor getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public SaleDescriptor parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new SaleDescriptor(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public io.opencannabis.schema.product.struct.SaleDescriptor getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy