Class MessageIndex
java.lang.Object
de.wuespace.telestion.extension.mavlink.MessageIndex
Handling the linking processes of the MAVLink-message IDs to the right implementation.
Before being able to get the messages by id they must be registered here.
Note that this class should be used in a static context.
Before being able to get the messages by id they must be registered here.
Note that this class should be used in a static context.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Class<? extends MavlinkMessage>
get(long id)
Returns theMavlinkMessageClass
linked to the given id.
BasicallyHashMap.get(Object)
.
Note that if the given id is not registerednull
will be returned.static boolean
isRegistered(long id)
Returns if an id already has been linked to aMavlinkMessage
.static void
put(long id, Class<? extends MavlinkMessage> clazz)
Registers a new item by linking a new id to a class.
BasicallyHashMap.put(Object, Object)
.
Note that if an otherMavlinkMessage
has already been linked with the given id an willIllegalArgumentException
be thrown.
-
Method Details
-
put
Registers a new item by linking a new id to a class.
BasicallyHashMap.put(Object, Object)
.
Note that if an otherMavlinkMessage
has already been linked with the given id an willIllegalArgumentException
be thrown.- Parameters:
id
- of the newMavlinkMessage-implementation
clazz
- Class of theMavlinkMessage
which should be linked- Throws:
IllegalArgumentException
- if the given id is already in use
-
isRegistered
public static boolean isRegistered(long id)Returns if an id already has been linked to aMavlinkMessage
.- Parameters:
id
- of the msg- Returns:
- whether an id is already associated with a
MavlinkMessage
-
get
Returns theMavlinkMessageClass
linked to the given id.
BasicallyHashMap.get(Object)
.
Note that if the given id is not registerednull
will be returned.- Parameters:
id
- of theMavlinkMessage
- Returns:
Class
of theMavlinkMessage
linked to the given id
-