org.apache.activemq.store.kahadb.data.KahaAddMessageCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of activemq-core Show documentation
Show all versions of activemq-core Show documentation
The ActiveMQ Message Broker and Client implementations
//
// Generated by protoc, do not edit by hand.
//
package org.apache.activemq.store.kahadb.data;
public final class KahaAddMessageCommand extends KahaAddMessageCommandBase implements org.apache.activemq.store.kahadb.JournalCommand {
public java.util.ArrayList missingFields() {
java.util.ArrayList missingFields = super.missingFields();
if( !hasDestination() ) {
missingFields.add("destination");
}
if( !hasMessageId() ) {
missingFields.add("messageId");
}
if( !hasMessage() ) {
missingFields.add("message");
}
if( hasTransactionInfo() ) {
try {
getTransactionInfo().assertInitialized();
} catch (org.apache.activemq.protobuf.UninitializedMessageException e){
missingFields.addAll(prefix(e.getMissingFields(),"transaction_info."));
}
}
if( hasDestination() ) {
try {
getDestination().assertInitialized();
} catch (org.apache.activemq.protobuf.UninitializedMessageException e){
missingFields.addAll(prefix(e.getMissingFields(),"destination."));
}
}
return missingFields;
}
public void clear() {
super.clear();
clearTransactionInfo();
clearDestination();
clearMessageId();
clearMessage();
}
public KahaAddMessageCommand clone() {
return new KahaAddMessageCommand().mergeFrom(this);
}
public KahaAddMessageCommand mergeFrom(KahaAddMessageCommand other) {
if (other.hasTransactionInfo()) {
if (hasTransactionInfo()) {
getTransactionInfo().mergeFrom(other.getTransactionInfo());
} else {
setTransactionInfo(other.getTransactionInfo().clone());
}
}
if (other.hasDestination()) {
if (hasDestination()) {
getDestination().mergeFrom(other.getDestination());
} else {
setDestination(other.getDestination().clone());
}
}
if (other.hasMessageId()) {
setMessageId(other.getMessageId());
}
if (other.hasMessage()) {
setMessage(other.getMessage());
}
return this;
}
public int serializedSizeUnframed() {
if (memoizedSerializedSize != -1)
return memoizedSerializedSize;
int size = 0;
if (hasTransactionInfo()) {
size += computeMessageSize(1, getTransactionInfo());
}
if (hasDestination()) {
size += computeMessageSize(2, getDestination());
}
if (hasMessageId()) {
size += org.apache.activemq.protobuf.CodedOutputStream.computeStringSize(3, getMessageId());
}
if (hasMessage()) {
size += org.apache.activemq.protobuf.CodedOutputStream.computeBytesSize(4, getMessage());
}
memoizedSerializedSize = size;
return size;
}
public KahaAddMessageCommand mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
while (true) {
int tag = input.readTag();
if ((tag & 0x07) == 4) {
return this;
}
switch (tag) {
case 0:
return this;
default: {
break;
}
case 10:
if (hasTransactionInfo()) {
getTransactionInfo().mergeFramed(input);
} else {
setTransactionInfo(new KahaTransactionInfo().mergeFramed(input));
}
break;
case 18:
if (hasDestination()) {
getDestination().mergeFramed(input);
} else {
setDestination(new KahaDestination().mergeFramed(input));
}
break;
case 26:
setMessageId(input.readString());
break;
case 34:
setMessage(input.readBytes());
break;
}
}
}
public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
if (hasTransactionInfo()) {
writeMessage(output, 1, getTransactionInfo());
}
if (hasDestination()) {
writeMessage(output, 2, getDestination());
}
if (hasMessageId()) {
output.writeString(3, getMessageId());
}
if (hasMessage()) {
output.writeBytes(4, getMessage());
}
}
public static KahaAddMessageCommand parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
return new KahaAddMessageCommand().mergeUnframed(data).checktInitialized();
}
public static KahaAddMessageCommand parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
return new KahaAddMessageCommand().mergeUnframed(data).checktInitialized();
}
public static KahaAddMessageCommand parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
return new KahaAddMessageCommand().mergeUnframed(data).checktInitialized();
}
public static KahaAddMessageCommand parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
return new KahaAddMessageCommand().mergeUnframed(data).checktInitialized();
}
public static KahaAddMessageCommand parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
return new KahaAddMessageCommand().mergeFramed(data).checktInitialized();
}
public static KahaAddMessageCommand parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
return new KahaAddMessageCommand().mergeFramed(data).checktInitialized();
}
public static KahaAddMessageCommand parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
return new KahaAddMessageCommand().mergeFramed(data).checktInitialized();
}
public static KahaAddMessageCommand parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
return new KahaAddMessageCommand().mergeFramed(data).checktInitialized();
}
public String toString() {
return toString(new java.lang.StringBuilder(), "").toString();
}
public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
if( hasTransactionInfo() ) {
sb.append(prefix+"transaction_info {\n");
getTransactionInfo().toString(sb, prefix+" ");
sb.append(prefix+"}\n");
}
if( hasDestination() ) {
sb.append(prefix+"destination {\n");
getDestination().toString(sb, prefix+" ");
sb.append(prefix+"}\n");
}
if( hasMessageId() ) {
sb.append(prefix+"messageId: ");
sb.append(getMessageId());
sb.append("\n");
}
if( hasMessage() ) {
sb.append(prefix+"message: ");
sb.append(getMessage());
sb.append("\n");
}
return sb;
}
public void visit(org.apache.activemq.store.kahadb.Visitor visitor) throws java.io.IOException {
visitor.visit(this);
}
public KahaEntryType type() {
return KahaEntryType.KAHA_ADD_MESSAGE_COMMAND;
}
public boolean equals(Object obj) {
if( obj==this )
return true;
if( obj==null || obj.getClass()!=KahaAddMessageCommand.class )
return false;
return equals((KahaAddMessageCommand)obj);
}
public boolean equals(KahaAddMessageCommand obj) {
if (hasTransactionInfo() ^ obj.hasTransactionInfo() )
return false;
if (hasTransactionInfo() && ( !getTransactionInfo().equals(obj.getTransactionInfo()) ))
return false;
if (hasDestination() ^ obj.hasDestination() )
return false;
if (hasDestination() && ( !getDestination().equals(obj.getDestination()) ))
return false;
if (hasMessageId() ^ obj.hasMessageId() )
return false;
if (hasMessageId() && ( !getMessageId().equals(obj.getMessageId()) ))
return false;
if (hasMessage() ^ obj.hasMessage() )
return false;
if (hasMessage() && ( !getMessage().equals(obj.getMessage()) ))
return false;
return true;
}
public int hashCode() {
int rc=1601475350;
if (hasTransactionInfo()) {
rc ^= ( 265667724^getTransactionInfo().hashCode() );
}
if (hasDestination()) {
rc ^= ( 238021614^getDestination().hashCode() );
}
if (hasMessageId()) {
rc ^= ( 563954530^getMessageId().hashCode() );
}
if (hasMessage()) {
rc ^= ( -1675388953^getMessage().hashCode() );
}
return rc;
}
}
abstract class KahaAddMessageCommandBase extends org.apache.activemq.protobuf.BaseMessage {
// optional KahaTransactionInfo transaction_info = 1;
private KahaTransactionInfo f_transactionInfo = null;
public boolean hasTransactionInfo() {
return this.f_transactionInfo!=null;
}
public KahaTransactionInfo getTransactionInfo() {
if( this.f_transactionInfo == null ) {
this.f_transactionInfo = new KahaTransactionInfo();
}
return this.f_transactionInfo;
}
public T setTransactionInfo(KahaTransactionInfo transactionInfo) {
loadAndClear();
this.f_transactionInfo = transactionInfo;
return (T)this;
}
public void clearTransactionInfo() {
loadAndClear();
this.f_transactionInfo = null;
}
// required KahaDestination destination = 2;
private KahaDestination f_destination = null;
public boolean hasDestination() {
return this.f_destination!=null;
}
public KahaDestination getDestination() {
if( this.f_destination == null ) {
this.f_destination = new KahaDestination();
}
return this.f_destination;
}
public T setDestination(KahaDestination destination) {
loadAndClear();
this.f_destination = destination;
return (T)this;
}
public void clearDestination() {
loadAndClear();
this.f_destination = null;
}
// required string messageId = 3;
private java.lang.String f_messageId = null;
private boolean b_messageId;
public boolean hasMessageId() {
return this.b_messageId;
}
public java.lang.String getMessageId() {
return this.f_messageId;
}
public T setMessageId(java.lang.String messageId) {
loadAndClear();
this.b_messageId = true;
this.f_messageId = messageId;
return (T)this;
}
public void clearMessageId() {
loadAndClear();
this.b_messageId = false;
this.f_messageId = null;
}
// required bytes message = 4;
private org.apache.activemq.protobuf.Buffer f_message = null;
private boolean b_message;
public boolean hasMessage() {
return this.b_message;
}
public org.apache.activemq.protobuf.Buffer getMessage() {
return this.f_message;
}
public T setMessage(org.apache.activemq.protobuf.Buffer message) {
loadAndClear();
this.b_message = true;
this.f_message = message;
return (T)this;
}
public void clearMessage() {
loadAndClear();
this.b_message = false;
this.f_message = null;
}
}