Package net.sf.freecol.common.networking
Class ObjectMessage
- java.lang.Object
-
- net.sf.freecol.common.networking.Message
-
- net.sf.freecol.common.networking.TrivialMessage
-
- net.sf.freecol.common.networking.AttributeMessage
-
- net.sf.freecol.common.networking.ObjectMessage
-
- Direct Known Subclasses:
AddPlayerMessage
,AnimateAttackMessage
,AnimateMoveMessage
,DeliverGiftMessage
,DiplomacyMessage
,ErrorMessage
,FeatureChangeMessage
,HighScoresMessage
,LoginMessage
,LootCargoMessage
,MonarchActionMessage
,NationSummaryMessage
,NativeTradeMessage
,NewTradeRouteMessage
,ServerListMessage
,SetGoodsLevelsMessage
,SpySettlementMessage
,UpdateGameOptionsMessage
,UpdateMapGeneratorOptionsMessage
,UpdateMessage
,UpdateTradeRouteMessage
public abstract class ObjectMessage extends AttributeMessage
The basic message with optional objects.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.freecol.common.networking.Message
Message.MessagePriority
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<FreeColObject>
objects
The attached FreeColObjects.-
Fields inherited from class net.sf.freecol.common.networking.AttributeMessage
attributes, TAG
-
Fields inherited from class net.sf.freecol.common.networking.TrivialMessage
continueMessage, disconnectMessage, endTurnMessage, enterRevengeModeMessage, reconnectMessage, requestLaunchMessage, retireMessage, startGameMessage
-
Fields inherited from class net.sf.freecol.common.networking.Message
logger, messagePriorityComparator
-
-
Constructor Summary
Constructors Modifier Constructor Description ObjectMessage(java.lang.String type)
Create a newObjectMessage
of a given type.ObjectMessage(java.lang.String type, java.lang.String... attributes)
Create a newObjectMessage
of a given type, with attributes and optional objects.protected
ObjectMessage(java.lang.String type, FreeColXMLReader xr, java.lang.String... attributes)
Create a newAttributeMessage
from a stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T extends FreeColObject>
voidappendChild(T fco)
Append a new child.protected <T extends FreeColObject>
voidappendChildren(java.util.Collection<T> fcos)
Append a multiple new children.protected int
getChildCount()
Get the number of child objects.protected java.util.List<FreeColObject>
getChildren()
Get the child objects of this message.protected void
setChildren(java.util.List<? extends FreeColObject> fcos)
Set the list of objects attached to this message.-
Methods inherited from class net.sf.freecol.common.networking.AttributeMessage
canMerge, getPriority, getStringAttribute, getStringAttributeMap, hasAttribute, setMergeable, setStringAttribute
-
Methods inherited from class net.sf.freecol.common.networking.TrivialMessage
aiHandler, clientHandler, currentPlayerMessage, getType, serverHandler, setType
-
Methods inherited from class net.sf.freecol.common.networking.Message
clientGeneric, expected, getArrayAttributes, getBooleanAttribute, getChild, getChildren, getEnumAttribute, getIntegerAttribute, getPriorityLevel, igc, igc, invokeAndWait, invokeLater, isEmpty, isType, merge, pgc, pgc, pretty, read, setArrayAttributes, setArrayAttributes, setBooleanAttribute, setEnumAttribute, setIntegerAttribute, setStringAttributeMap, setStringAttributes, setStringAttributes, toString, toXML, writeAttributes, writeChildren
-
-
-
-
Field Detail
-
objects
private final java.util.List<FreeColObject> objects
The attached FreeColObjects.
-
-
Constructor Detail
-
ObjectMessage
public ObjectMessage(java.lang.String type)
Create a newObjectMessage
of a given type.- Parameters:
type
- The message type.
-
ObjectMessage
public ObjectMessage(java.lang.String type, java.lang.String... attributes)
Create a newObjectMessage
of a given type, with attributes and optional objects.- Parameters:
type
- The message type.attributes
- A list of key,value pairs.
-
ObjectMessage
protected ObjectMessage(java.lang.String type, FreeColXMLReader xr, java.lang.String... attributes)
Create a newAttributeMessage
from a stream.- Parameters:
type
- The message type.xr
- TheFreeColXMLReader
to read from.attributes
- The attributes to read.
-
-
Method Detail
-
getChildCount
protected int getChildCount()
Get the number of child objects.- Overrides:
getChildCount
in classTrivialMessage
- Returns:
- The child count.
-
getChildren
protected java.util.List<FreeColObject> getChildren()
Get the child objects of this message.- Overrides:
getChildren
in classTrivialMessage
- Returns:
- A list of child
FreeColObject
s.
-
setChildren
protected void setChildren(java.util.List<? extends FreeColObject> fcos)
Set the list of objects attached to this message.- Overrides:
setChildren
in classTrivialMessage
- Parameters:
fcos
- The new list of attachedFreeColObject
s.
-
appendChild
protected <T extends FreeColObject> void appendChild(T fco)
Append a new child.- Overrides:
appendChild
in classTrivialMessage
- Type Parameters:
T
- The child type.- Parameters:
fco
- The new child object.
-
appendChildren
protected <T extends FreeColObject> void appendChildren(java.util.Collection<T> fcos)
Append a multiple new children.- Overrides:
appendChildren
in classTrivialMessage
- Type Parameters:
T
- The child type.- Parameters:
fcos
- The new child objects.
-
-