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

org.skyscreamer.nevado.jms.message.NevadoTextMessage Maven / Gradle / Ivy

The newest version!
package org.skyscreamer.nevado.jms.message;

import org.apache.commons.lang.builder.HashCodeBuilder;

import javax.jms.JMSException;
import javax.jms.TextMessage;

public class NevadoTextMessage extends NevadoMessage implements TextMessage {
    private String _body;

    public NevadoTextMessage() {}

    protected NevadoTextMessage(TextMessage message) throws JMSException {
        super(message);
        _body = message.getText();
    }

    public void setText(String text) throws JMSException {
        checkReadOnlyBody();
        _body = text;
    }

    public String getText() throws JMSException {
        return _body;
    }

    @Override
    public void internalClearBody() throws JMSException {
        _body = null;
    }

    @Override
    public String toString() {
        return _body;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        NevadoTextMessage that = (NevadoTextMessage) o;

        if (_messageID != null ? !_messageID.equals(that._messageID) : that._messageID != null) return false;
        if (_body != null ? !_body.equals(that._body) : that._body != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder().append(_messageID).append(_body).toHashCode();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy