soc.message
Interface SOCMessageForGame

All Known Implementing Classes:
SOCAcceptOffer, SOCAdminPing, SOCBankTrade, SOCBoardLayout, SOCBoardLayout2, SOCBoardSpecialEdge, SOCBuildRequest, SOCBuyCardRequest, SOCCancelBuildRequest, SOCChangeFace, SOCChoosePlayer, SOCChoosePlayerRequest, SOCClearOffer, SOCClearTradeMsg, SOCDebugFreePlace, SOCDeleteGame, SOCDevCardAction, SOCDevCardCount, SOCDiceResult, SOCDiceResultResources, SOCDiscard, SOCDiscardRequest, SOCDiscoveryPick, SOCEndTurn, SOCFirstPlayer, SOCGameMembers, SOCGameOptionInfo, SOCGameServerText, SOCGameState, SOCGameStats, SOCGamesWithOptions, SOCGameTextMsg, SOCInventoryItemAction, SOCJoinGameAuth, SOCLargestArmy, SOCLastSettlement, SOCLeaveGame, SOCLegalEdges, SOCLocalizedStrings, SOCLongestRoad, SOCMakeOffer, SOCMessageTemplate0, SOCMessageTemplate1i, SOCMessageTemplate1s, SOCMessageTemplate2i, SOCMessageTemplate2s, SOCMessageTemplate3i, SOCMessageTemplate3s, SOCMessageTemplate4i, SOCMessageTemplateMi, SOCMessageTemplateMs, SOCMonopolyPick, SOCMovePiece, SOCMovePieceRequest, SOCMoveRobber, SOCNewGame, SOCNewGameWithOptions, SOCPickResources, SOCPickResourcesRequest, SOCPieceValue, SOCPlayDevCardRequest, SOCPlayerElement, SOCPlayerElements, SOCPlayerStats, SOCPotentialSettlements, SOCPutPiece, SOCRejectOffer, SOCRemovePiece, SOCResetBoardAuth, SOCResetBoardReject, SOCResetBoardRequest, SOCResetBoardVote, SOCResetBoardVoteRequest, SOCResourceCount, SOCRevealFogHex, SOCRobotDismiss, SOCRobotJoinGameRequest, SOCRollDice, SOCRollDicePrompt, SOCRollDiceRequest, SOCScenarioInfo, SOCSetPlayedDevCard, SOCSetSeatLock, SOCSetSpecialItem, SOCSetTurn, SOCSetupDone, SOCSimpleAction, SOCSimpleRequest, SOCSitDown, SOCStartGame, SOCSVPTextMessage, SOCTimingPing, SOCTurn

public interface SOCMessageForGame

This indicates that a SOCMessage type is always about a particular game named in the message, or never about that game.

Check that getGame() is not null before adding to a per-game message queue.

Most implementing types' constructors will always require a game; some abstract subclasses such as SOCMessageTemplateMi may allow null, leaving the choice to each of their own subclasses. Non-abstract message types must always return a game name from getGame(), never null.

Template classes such as SOCMessageTemplateMi are convenient for quickly developing a new message type, but they all implement SOCMessageForGame. If the template classes are used for non-game data from a server, the server will use SOCMessage.GAME_NONE as the "game name".

Since:
1.1.11
Author:
Jeremy D Monin

Method Summary
 java.lang.String getGame()
          Name of game this message is for.
 int getType()
          Get the message type.
 

Method Detail

getGame

java.lang.String getGame()
Name of game this message is for. Must not be null if message is in per-game structures or code.

At the server, the message treater dispatches incoming SOCMessageForGames based on their getGame():

Returns:
the name of the game, or (rarely) null if none.
See Also:
SOCMessage.GAME_NONE

getType

int getType()
Get the message type. Implemented in SOCMessage.

Returns:
the message type
Since:
2.0.00