Class Message
- java.lang.Object
-
- org.deepsymmetry.libcarabiner.Message
-
public class Message extends Object
Simplifies the interpretation of messages sent by Carabiner by converting them from their Extensible Data Notation format to more familiar Java structures. Each message consists of a type symbol, optionally followed by a map of keywords and values. Constructing a
Message
object provides easy access to those values, with the symbol and keywords replaced by ordinary interned JavaString
instances.For example, if instantiated with the string
"status { :peers 0 :bpm 120.000000 :start 73743731220 :beat 597.737570 }"
, aMessage
instance would have amessageType
of"status"
, and itsdetails
would be aMap
with keys"peers"
(holding theLong
value0
),"bpm"
(holding theDouble
value120.0
),"start"
(holding theLong
value73743731220
), and"beat"
(holding theDouble
value597.737570
).An instance constructed with the string
"bad-beat"
would have amessageType
of"bad-beat"
and anull
details
.Once constructed, Message objects are immutable data holders.
Created by James Elliott on 2020-01-19.
-
-
Field Detail
-
messageType
public final String messageType
Identifies the type of the message that was received, which was the symbol that the message started with. This value is interned, so message types can be compared for equality by object identity.
-
-