Package VASSAL.property
Interface PersistentPropertyContainer
- All Known Implementing Classes:
ActionButton
,AreaOfEffect
,Attachment
,BasicName
,BasicPiece
,BorderOutline
,CalculatedProperty
,Clone
,Comment
,CounterGlobalKeyCommand
,Decorator
,Delete
,Deselect
,DynamicProperty
,Embellishment
,Embellishment0
,Footprint
,FreeRotator
,GlobalHotKey
,Hideable
,Immobilized
,Labeler
,Marker
,Mat
,MatCargo
,MenuSeparator
,MovementMarkable
,MultiLocationCommand
,NonRectangular
,Obscurable
,Pivot
,PlaceMarker
,PlaySound
,PropertySheet
,Replace
,ReportState
,RestrictCommands
,Restricted
,ReturnToDeck
,SendToLocation
,SetGlobalProperty
,SetPieceProperty
,SubMenu
,TableInfo
,TranslatableMessage
,Translate
,TriggerAction
,UsePrototype
public interface PersistentPropertyContainer
A container holding properties that must be maintained as part of the Game State (saved with saved games, passed to
other clients via logfile/server, etc).
-
Method Summary
Modifier and TypeMethodDescriptionsetPersistentProperty
(Object key, Object val) Setting a persistent property writes a property value into the piece (creating a new entry in the piece's persistent property table if the specified key does not yet exist in it).
-
Method Details
-
setPersistentProperty
Setting a persistent property writes a property value into the piece (creating a new entry in the piece's persistent property table if the specified key does not yet exist in it). Persistent properties are game-state-robust: they are saved/restored with saved games, and are passed viaCommand
to other players' clients in a multiplayer game. The persistent property value can then be read from the piece via e.g. #getProperty. When reading back properties out of a piece, the piece's built-in properties are checked first, then scratchpad properties (see #setProperty), then external properties such as Global Properties. If only persistentProperties are to be searched, usegetPersistentProperty(java.lang.Object)
instead.
In practical terms, setPersistentProperty is used mainly to implement the "Old" properties of BasicPiece (e.g. "OldLocationName", "OldZone", "OldMap", "OldBoard", "OldX", "OldY"). A Persistent Property is indeed nearly identical with DynamicProperty in storage/retrieval characteristics, and simply lacks the in-module interface for setting values, etc. Module Designers are thus recommended to stick with Dynamic Property traits for these functions.- Parameters:
key
- String key naming the persistent property to be set. If a corresponding persistent property does not exist it will be created.val
- New value for the persistent property- Returns:
- a
Command
object which, when passed to another player's client via logfile, server, or saved game, will allow the result of the "set" operation to be replicated.
-
getPersistentProperty
-