net.lightapi.portal.user.OrderCancelledEvent Maven / Gradle / Ivy
The newest version!
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package net.lightapi.portal.user;
import org.apache.avro.generic.GenericArray;
import org.apache.avro.specific.SpecificData;
import org.apache.avro.util.Utf8;
import org.apache.avro.message.BinaryMessageEncoder;
import org.apache.avro.message.BinaryMessageDecoder;
import org.apache.avro.message.SchemaStore;
@org.apache.avro.specific.AvroGenerated
public class OrderCancelledEvent extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
private static final long serialVersionUID = 4234175427684080516L;
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"OrderCancelledEvent\",\"namespace\":\"net.lightapi.portal.user\",\"fields\":[{\"name\":\"EventId\",\"type\":{\"type\":\"record\",\"name\":\"EventId\",\"namespace\":\"com.networknt.kafka.common\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"a unique identifier\"},{\"name\":\"nonce\",\"type\":\"long\",\"doc\":\"the number of the transactions for the id\"},{\"name\":\"derived\",\"type\":\"boolean\",\"doc\":\"indicate if the event is derived from event processor\",\"default\":false}]}},{\"name\":\"email\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"email of the customer\"},{\"name\":\"merchantEmail\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"Merchant Email\"},{\"name\":\"orderId\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"doc\":\"The orderId\"},{\"name\":\"timestamp\",\"type\":\"long\",\"doc\":\"time the event is recorded\",\"default\":0}]}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
private static final SpecificData MODEL$ = new SpecificData();
private static final BinaryMessageEncoder ENCODER =
new BinaryMessageEncoder(MODEL$, SCHEMA$);
private static final BinaryMessageDecoder DECODER =
new BinaryMessageDecoder(MODEL$, SCHEMA$);
/**
* Return the BinaryMessageEncoder instance used by this class.
* @return the message encoder used by this class
*/
public static BinaryMessageEncoder getEncoder() {
return ENCODER;
}
/**
* Return the BinaryMessageDecoder instance used by this class.
* @return the message decoder used by this class
*/
public static BinaryMessageDecoder getDecoder() {
return DECODER;
}
/**
* Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}.
* @param resolver a {@link SchemaStore} used to find schemas by fingerprint
* @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore
*/
public static BinaryMessageDecoder createDecoder(SchemaStore resolver) {
return new BinaryMessageDecoder(MODEL$, SCHEMA$, resolver);
}
/**
* Serializes this OrderCancelledEvent to a ByteBuffer.
* @return a buffer holding the serialized data for this instance
* @throws java.io.IOException if this instance could not be serialized
*/
public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
return ENCODER.encode(this);
}
/**
* Deserializes a OrderCancelledEvent from a ByteBuffer.
* @param b a byte buffer holding serialized data for an instance of this class
* @return a OrderCancelledEvent instance decoded from the given buffer
* @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class
*/
public static OrderCancelledEvent fromByteBuffer(
java.nio.ByteBuffer b) throws java.io.IOException {
return DECODER.decode(b);
}
private com.networknt.kafka.common.EventId EventId;
/** email of the customer */
private java.lang.String email;
/** Merchant Email */
private java.lang.String merchantEmail;
/** The orderId */
private java.lang.String orderId;
/** time the event is recorded */
private long timestamp;
/**
* Default constructor. Note that this does not initialize fields
* to their default values from the schema. If that is desired then
* one should use newBuilder()
.
*/
public OrderCancelledEvent() {}
/**
* All-args constructor.
* @param EventId The new value for EventId
* @param email email of the customer
* @param merchantEmail Merchant Email
* @param orderId The orderId
* @param timestamp time the event is recorded
*/
public OrderCancelledEvent(com.networknt.kafka.common.EventId EventId, java.lang.String email, java.lang.String merchantEmail, java.lang.String orderId, java.lang.Long timestamp) {
this.EventId = EventId;
this.email = email;
this.merchantEmail = merchantEmail;
this.orderId = orderId;
this.timestamp = timestamp;
}
public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
switch (field$) {
case 0: return EventId;
case 1: return email;
case 2: return merchantEmail;
case 3: return orderId;
case 4: return timestamp;
default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
}
}
// Used by DatumReader. Applications should not call.
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
case 0: EventId = (com.networknt.kafka.common.EventId)value$; break;
case 1: email = value$ != null ? value$.toString() : null; break;
case 2: merchantEmail = value$ != null ? value$.toString() : null; break;
case 3: orderId = value$ != null ? value$.toString() : null; break;
case 4: timestamp = (java.lang.Long)value$; break;
default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
}
}
/**
* Gets the value of the 'EventId' field.
* @return The value of the 'EventId' field.
*/
public com.networknt.kafka.common.EventId getEventId() {
return EventId;
}
/**
* Sets the value of the 'EventId' field.
* @param value the value to set.
*/
public void setEventId(com.networknt.kafka.common.EventId value) {
this.EventId = value;
}
/**
* Gets the value of the 'email' field.
* @return email of the customer
*/
public java.lang.String getEmail() {
return email;
}
/**
* Sets the value of the 'email' field.
* email of the customer
* @param value the value to set.
*/
public void setEmail(java.lang.String value) {
this.email = value;
}
/**
* Gets the value of the 'merchantEmail' field.
* @return Merchant Email
*/
public java.lang.String getMerchantEmail() {
return merchantEmail;
}
/**
* Sets the value of the 'merchantEmail' field.
* Merchant Email
* @param value the value to set.
*/
public void setMerchantEmail(java.lang.String value) {
this.merchantEmail = value;
}
/**
* Gets the value of the 'orderId' field.
* @return The orderId
*/
public java.lang.String getOrderId() {
return orderId;
}
/**
* Sets the value of the 'orderId' field.
* The orderId
* @param value the value to set.
*/
public void setOrderId(java.lang.String value) {
this.orderId = value;
}
/**
* Gets the value of the 'timestamp' field.
* @return time the event is recorded
*/
public long getTimestamp() {
return timestamp;
}
/**
* Sets the value of the 'timestamp' field.
* time the event is recorded
* @param value the value to set.
*/
public void setTimestamp(long value) {
this.timestamp = value;
}
/**
* Creates a new OrderCancelledEvent RecordBuilder.
* @return A new OrderCancelledEvent RecordBuilder
*/
public static net.lightapi.portal.user.OrderCancelledEvent.Builder newBuilder() {
return new net.lightapi.portal.user.OrderCancelledEvent.Builder();
}
/**
* Creates a new OrderCancelledEvent RecordBuilder by copying an existing Builder.
* @param other The existing builder to copy.
* @return A new OrderCancelledEvent RecordBuilder
*/
public static net.lightapi.portal.user.OrderCancelledEvent.Builder newBuilder(net.lightapi.portal.user.OrderCancelledEvent.Builder other) {
if (other == null) {
return new net.lightapi.portal.user.OrderCancelledEvent.Builder();
} else {
return new net.lightapi.portal.user.OrderCancelledEvent.Builder(other);
}
}
/**
* Creates a new OrderCancelledEvent RecordBuilder by copying an existing OrderCancelledEvent instance.
* @param other The existing instance to copy.
* @return A new OrderCancelledEvent RecordBuilder
*/
public static net.lightapi.portal.user.OrderCancelledEvent.Builder newBuilder(net.lightapi.portal.user.OrderCancelledEvent other) {
if (other == null) {
return new net.lightapi.portal.user.OrderCancelledEvent.Builder();
} else {
return new net.lightapi.portal.user.OrderCancelledEvent.Builder(other);
}
}
/**
* RecordBuilder for OrderCancelledEvent instances.
*/
@org.apache.avro.specific.AvroGenerated
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
implements org.apache.avro.data.RecordBuilder {
private com.networknt.kafka.common.EventId EventId;
private com.networknt.kafka.common.EventId.Builder EventIdBuilder;
/** email of the customer */
private java.lang.String email;
/** Merchant Email */
private java.lang.String merchantEmail;
/** The orderId */
private java.lang.String orderId;
/** time the event is recorded */
private long timestamp;
/** Creates a new Builder */
private Builder() {
super(SCHEMA$, MODEL$);
}
/**
* Creates a Builder by copying an existing Builder.
* @param other The existing Builder to copy.
*/
private Builder(net.lightapi.portal.user.OrderCancelledEvent.Builder other) {
super(other);
if (isValidValue(fields()[0], other.EventId)) {
this.EventId = data().deepCopy(fields()[0].schema(), other.EventId);
fieldSetFlags()[0] = other.fieldSetFlags()[0];
}
if (other.hasEventIdBuilder()) {
this.EventIdBuilder = com.networknt.kafka.common.EventId.newBuilder(other.getEventIdBuilder());
}
if (isValidValue(fields()[1], other.email)) {
this.email = data().deepCopy(fields()[1].schema(), other.email);
fieldSetFlags()[1] = other.fieldSetFlags()[1];
}
if (isValidValue(fields()[2], other.merchantEmail)) {
this.merchantEmail = data().deepCopy(fields()[2].schema(), other.merchantEmail);
fieldSetFlags()[2] = other.fieldSetFlags()[2];
}
if (isValidValue(fields()[3], other.orderId)) {
this.orderId = data().deepCopy(fields()[3].schema(), other.orderId);
fieldSetFlags()[3] = other.fieldSetFlags()[3];
}
if (isValidValue(fields()[4], other.timestamp)) {
this.timestamp = data().deepCopy(fields()[4].schema(), other.timestamp);
fieldSetFlags()[4] = other.fieldSetFlags()[4];
}
}
/**
* Creates a Builder by copying an existing OrderCancelledEvent instance
* @param other The existing instance to copy.
*/
private Builder(net.lightapi.portal.user.OrderCancelledEvent other) {
super(SCHEMA$, MODEL$);
if (isValidValue(fields()[0], other.EventId)) {
this.EventId = data().deepCopy(fields()[0].schema(), other.EventId);
fieldSetFlags()[0] = true;
}
this.EventIdBuilder = null;
if (isValidValue(fields()[1], other.email)) {
this.email = data().deepCopy(fields()[1].schema(), other.email);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.merchantEmail)) {
this.merchantEmail = data().deepCopy(fields()[2].schema(), other.merchantEmail);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.orderId)) {
this.orderId = data().deepCopy(fields()[3].schema(), other.orderId);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.timestamp)) {
this.timestamp = data().deepCopy(fields()[4].schema(), other.timestamp);
fieldSetFlags()[4] = true;
}
}
/**
* Gets the value of the 'EventId' field.
* @return The value.
*/
public com.networknt.kafka.common.EventId getEventId() {
return EventId;
}
/**
* Sets the value of the 'EventId' field.
* @param value The value of 'EventId'.
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder setEventId(com.networknt.kafka.common.EventId value) {
validate(fields()[0], value);
this.EventIdBuilder = null;
this.EventId = value;
fieldSetFlags()[0] = true;
return this;
}
/**
* Checks whether the 'EventId' field has been set.
* @return True if the 'EventId' field has been set, false otherwise.
*/
public boolean hasEventId() {
return fieldSetFlags()[0];
}
/**
* Gets the Builder instance for the 'EventId' field and creates one if it doesn't exist yet.
* @return This builder.
*/
public com.networknt.kafka.common.EventId.Builder getEventIdBuilder() {
if (EventIdBuilder == null) {
if (hasEventId()) {
setEventIdBuilder(com.networknt.kafka.common.EventId.newBuilder(EventId));
} else {
setEventIdBuilder(com.networknt.kafka.common.EventId.newBuilder());
}
}
return EventIdBuilder;
}
/**
* Sets the Builder instance for the 'EventId' field
* @param value The builder instance that must be set.
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder setEventIdBuilder(com.networknt.kafka.common.EventId.Builder value) {
clearEventId();
EventIdBuilder = value;
return this;
}
/**
* Checks whether the 'EventId' field has an active Builder instance
* @return True if the 'EventId' field has an active Builder instance
*/
public boolean hasEventIdBuilder() {
return EventIdBuilder != null;
}
/**
* Clears the value of the 'EventId' field.
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder clearEventId() {
EventId = null;
EventIdBuilder = null;
fieldSetFlags()[0] = false;
return this;
}
/**
* Gets the value of the 'email' field.
* email of the customer
* @return The value.
*/
public java.lang.String getEmail() {
return email;
}
/**
* Sets the value of the 'email' field.
* email of the customer
* @param value The value of 'email'.
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder setEmail(java.lang.String value) {
validate(fields()[1], value);
this.email = value;
fieldSetFlags()[1] = true;
return this;
}
/**
* Checks whether the 'email' field has been set.
* email of the customer
* @return True if the 'email' field has been set, false otherwise.
*/
public boolean hasEmail() {
return fieldSetFlags()[1];
}
/**
* Clears the value of the 'email' field.
* email of the customer
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder clearEmail() {
email = null;
fieldSetFlags()[1] = false;
return this;
}
/**
* Gets the value of the 'merchantEmail' field.
* Merchant Email
* @return The value.
*/
public java.lang.String getMerchantEmail() {
return merchantEmail;
}
/**
* Sets the value of the 'merchantEmail' field.
* Merchant Email
* @param value The value of 'merchantEmail'.
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder setMerchantEmail(java.lang.String value) {
validate(fields()[2], value);
this.merchantEmail = value;
fieldSetFlags()[2] = true;
return this;
}
/**
* Checks whether the 'merchantEmail' field has been set.
* Merchant Email
* @return True if the 'merchantEmail' field has been set, false otherwise.
*/
public boolean hasMerchantEmail() {
return fieldSetFlags()[2];
}
/**
* Clears the value of the 'merchantEmail' field.
* Merchant Email
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder clearMerchantEmail() {
merchantEmail = null;
fieldSetFlags()[2] = false;
return this;
}
/**
* Gets the value of the 'orderId' field.
* The orderId
* @return The value.
*/
public java.lang.String getOrderId() {
return orderId;
}
/**
* Sets the value of the 'orderId' field.
* The orderId
* @param value The value of 'orderId'.
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder setOrderId(java.lang.String value) {
validate(fields()[3], value);
this.orderId = value;
fieldSetFlags()[3] = true;
return this;
}
/**
* Checks whether the 'orderId' field has been set.
* The orderId
* @return True if the 'orderId' field has been set, false otherwise.
*/
public boolean hasOrderId() {
return fieldSetFlags()[3];
}
/**
* Clears the value of the 'orderId' field.
* The orderId
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder clearOrderId() {
orderId = null;
fieldSetFlags()[3] = false;
return this;
}
/**
* Gets the value of the 'timestamp' field.
* time the event is recorded
* @return The value.
*/
public long getTimestamp() {
return timestamp;
}
/**
* Sets the value of the 'timestamp' field.
* time the event is recorded
* @param value The value of 'timestamp'.
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder setTimestamp(long value) {
validate(fields()[4], value);
this.timestamp = value;
fieldSetFlags()[4] = true;
return this;
}
/**
* Checks whether the 'timestamp' field has been set.
* time the event is recorded
* @return True if the 'timestamp' field has been set, false otherwise.
*/
public boolean hasTimestamp() {
return fieldSetFlags()[4];
}
/**
* Clears the value of the 'timestamp' field.
* time the event is recorded
* @return This builder.
*/
public net.lightapi.portal.user.OrderCancelledEvent.Builder clearTimestamp() {
fieldSetFlags()[4] = false;
return this;
}
@Override
@SuppressWarnings("unchecked")
public OrderCancelledEvent build() {
try {
OrderCancelledEvent record = new OrderCancelledEvent();
if (EventIdBuilder != null) {
try {
record.EventId = this.EventIdBuilder.build();
} catch (org.apache.avro.AvroMissingFieldException e) {
e.addParentField(record.getSchema().getField("EventId"));
throw e;
}
} else {
record.EventId = fieldSetFlags()[0] ? this.EventId : (com.networknt.kafka.common.EventId) defaultValue(fields()[0]);
}
record.email = fieldSetFlags()[1] ? this.email : (java.lang.String) defaultValue(fields()[1]);
record.merchantEmail = fieldSetFlags()[2] ? this.merchantEmail : (java.lang.String) defaultValue(fields()[2]);
record.orderId = fieldSetFlags()[3] ? this.orderId : (java.lang.String) defaultValue(fields()[3]);
record.timestamp = fieldSetFlags()[4] ? this.timestamp : (java.lang.Long) defaultValue(fields()[4]);
return record;
} catch (org.apache.avro.AvroMissingFieldException e) {
throw e;
} catch (java.lang.Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
@SuppressWarnings("unchecked")
private static final org.apache.avro.io.DatumWriter
WRITER$ = (org.apache.avro.io.DatumWriter)MODEL$.createDatumWriter(SCHEMA$);
@Override public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException {
WRITER$.write(this, SpecificData.getEncoder(out));
}
@SuppressWarnings("unchecked")
private static final org.apache.avro.io.DatumReader
READER$ = (org.apache.avro.io.DatumReader)MODEL$.createDatumReader(SCHEMA$);
@Override public void readExternal(java.io.ObjectInput in)
throws java.io.IOException {
READER$.read(this, SpecificData.getDecoder(in));
}
@Override protected boolean hasCustomCoders() { return true; }
@Override public void customEncode(org.apache.avro.io.Encoder out)
throws java.io.IOException
{
this.EventId.customEncode(out);
out.writeString(this.email);
out.writeString(this.merchantEmail);
out.writeString(this.orderId);
out.writeLong(this.timestamp);
}
@Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
throws java.io.IOException
{
org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
if (fieldOrder == null) {
if (this.EventId == null) {
this.EventId = new com.networknt.kafka.common.EventId();
}
this.EventId.customDecode(in);
this.email = in.readString();
this.merchantEmail = in.readString();
this.orderId = in.readString();
this.timestamp = in.readLong();
} else {
for (int i = 0; i < 5; i++) {
switch (fieldOrder[i].pos()) {
case 0:
if (this.EventId == null) {
this.EventId = new com.networknt.kafka.common.EventId();
}
this.EventId.customDecode(in);
break;
case 1:
this.email = in.readString();
break;
case 2:
this.merchantEmail = in.readString();
break;
case 3:
this.orderId = in.readString();
break;
case 4:
this.timestamp = in.readLong();
break;
default:
throw new java.io.IOException("Corrupt ResolvingDecoder.");
}
}
}
}
}