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 theMavlinkMessageClasslinked to the given id.
BasicallyHashMap.get(Object).
Note that if the given id is not registerednullwill be returned.static booleanisRegistered(long id)Returns if an id already has been linked to aMavlinkMessage.static voidput(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 otherMavlinkMessagehas already been linked with the given id an willIllegalArgumentExceptionbe thrown.
-
Method Details
-
put
Registers a new item by linking a new id to a class.
BasicallyHashMap.put(Object, Object).
Note that if an otherMavlinkMessagehas already been linked with the given id an willIllegalArgumentExceptionbe thrown.- Parameters:
id- of the newMavlinkMessage-implementationclazz- Class of theMavlinkMessagewhich 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 theMavlinkMessageClasslinked to the given id.
BasicallyHashMap.get(Object).
Note that if the given id is not registerednullwill be returned.- Parameters:
id- of theMavlinkMessage- Returns:
Classof theMavlinkMessagelinked to the given id
-