Class Message
- java.lang.Object
-
- org.codehaus.plexus.build.connect.messages.Message
-
- Direct Known Subclasses:
InitMessage,MojoMessage,ProjectMessage,ProjectsMessage,RefreshMessage,SessionMessage
public class Message extends java.lang.ObjectA message exchanged between two endpoints, usually an IDE and a maven build
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Messagedecode(byte[] bytes)Decodes a message from its bytesbooleanequals(java.lang.Object obj)booleangetBooleanProperty(java.lang.String key)Get a boolean property from the payloadbooleangetBooleanProperty(java.lang.String key, boolean defaultValue)Get a boolean property from the payloadjava.lang.StringgetProperty(java.lang.String key)Get a String property from the payloadjava.lang.StringgetProperty(java.lang.String key, java.lang.String defaultValue)Get a String property from the payloadjava.lang.StringgetSessionId()inthashCode()java.util.stream.Stream<java.lang.String>keys()static MessagereplyTo(Message message, java.util.Map<java.lang.String,java.lang.String> payload)Creates a reply to a message using the thread id and session id from the original but with the provided payloadbyte[]serialize()byte[]serialize(java.lang.String sessionId)Creates bytes for this message using the session idjava.lang.StringtoString()
-
-
-
Method Detail
-
keys
public java.util.stream.Stream<java.lang.String> keys()
- Returns:
- the keys stored in this message
-
getProperty
public java.lang.String getProperty(java.lang.String key)
Get a String property from the payload- Parameters:
key- the key to fetch- Returns:
- the value
-
getProperty
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)Get a String property from the payload- Parameters:
key- the key to fetchdefaultValue- default value to use when no value is present- Returns:
- the value
-
getBooleanProperty
public boolean getBooleanProperty(java.lang.String key)
Get a boolean property from the payload- Parameters:
key- the key to fetch- Returns:
- the value
-
getBooleanProperty
public boolean getBooleanProperty(java.lang.String key, boolean defaultValue)Get a boolean property from the payload- Parameters:
key- the key to fetchdefaultValue- the value to use if not value is present- Returns:
- the value
-
getSessionId
public java.lang.String getSessionId()
- Returns:
- the remote session id for this message, only valid for messages not created locally
-
serialize
public byte[] serialize()
- Returns:
- the bytes using the message session id
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
serialize
public byte[] serialize(java.lang.String sessionId)
Creates bytes for this message using the session id- Parameters:
sessionId-- Returns:
- the bytes using the supplied message id
-
replyTo
public static Message replyTo(Message message, java.util.Map<java.lang.String,java.lang.String> payload)
Creates a reply to a message using the thread id and session id from the original but with the provided payload- Parameters:
message- the reply message to inherit frompayload- the new payload- Returns:
- the message
-
decode
public static Message decode(byte[] bytes)
Decodes a message from its bytes- Parameters:
bytes- the bytes to decode- Returns:
- the message or
nullif decoding failed
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-