com.backendless.messaging.MessageStatus Maven / Gradle / Ivy
package com.backendless.messaging;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
@ToString
@Accessors( chain = true )
@NoArgsConstructor
@Getter
@Setter
public class MessageStatus implements Comparable
{
private String messageId;
private String errorMessage;
private PublishStatusEnum status;
private Long sendingTimeInMillis;
private Long successfulSendsAmount;
private Long failedSendsAmount;
public MessageStatus( String messageId, PublishStatusEnum status )
{
this.messageId = messageId;
this.status = status;
}
@Override
public boolean equals( Object o )
{
if( this == o )
return true;
if( o == null || getClass() != o.getClass() )
return false;
MessageStatus that = (MessageStatus) o;
if( messageId != null ? !messageId.equals( that.messageId ) : that.messageId != null )
return false;
if( status != that.status )
return false;
return true;
}
@Override
public int hashCode()
{
int result = messageId != null ? messageId.hashCode() : 0;
result = 31 * result + status.hashCode();
return result;
}
@Override
public int compareTo( MessageStatus arg )
{
if( this == arg )
return 0;
int statusDiff = this.status == null ? (arg.getStatus() == null ? 0 : -1) : this.status.compareTo( arg.getStatus() );
if( statusDiff != 0 )
return statusDiff;
return this.messageId == null ? (arg.getMessageId() == null ? 0 : -1) : this.messageId.compareTo( arg.getMessageId() );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy