Skip to content
Snippets Groups Projects
Select Git revision
  • 330e9bd2624ab213827b0d3ba1a7210ce376c13f
  • master default protected
  • devel protected
  • weather_stuff
  • open_transport_stuff
  • gui-mq
  • gui-transport
  • dev_messageQueue
  • gui
9 results

Message.java

Blame
  • Michaël El Kharroubi (HES)'s avatar
    330e9bd2
    History
    Message.java 609 B
    package ch.hepia.mq;
    import java.io.Serializable;
    
    public final class Message implements Serializable {
        public static enum Type {
            JoinedJourney, LeftJourney
        }
        
        private static final long serialVersionUID = 0xAEF34565673L;
        private final Type type;
        private byte[] data;
    
        public <T extends Serializable> Message(Type type, T object) {
            this.type = type;
            this.data = MessageQueue.serialize(object);
        }
    
        public Type getMessageType() {
            return this.type;
        }
    
        public <T> T getData() {
            return MessageQueue.unserialize(this.data);
        }
    }