multiverse.server.messages
Class PropertyMessage

java.lang.Object
  extended by multiverse.msgsys.Message
      extended by multiverse.msgsys.SubjectMessage
          extended by multiverse.server.messages.PropertyMessage
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
WorldManagerClient.ExtensionMessage

public class PropertyMessage
extends SubjectMessage

general property about an obj/mob this is usually a statistic or state change, such as health, strength. Targeted state, such as whether a quest is available should use TargetedPropertyMessage

See Also:
Serialized Form

Field Summary
protected  Lock lock
           
static MessageType MSG_TYPE_PROPERTY
           
private  Namespace namespace
           
protected  Map<String,Serializable> propertyMap
           
private static long serialVersionUID
           
 
Fields inherited from class multiverse.msgsys.SubjectMessage
oid
 
Constructor Summary
PropertyMessage()
           
PropertyMessage(Long objOid)
           
PropertyMessage(Long objOid, Long notifyOid)
           
PropertyMessage(MessageType msgType)
           
PropertyMessage(MessageType msgType, Long objOid)
           
 
Method Summary
protected static int addPropertyStringElement(String key, Serializable val, List<String> propStrings, String version, int len)
           
static int createFilteredPropertyString(List<String> propStrings, Map<String,Serializable> propertyMap, String version, Set<String> filteredProps)
           
static int createPropertyString(List<String> propStrings, Map<String,Serializable> propertyMap, String version)
          Input parameter propStrings must be an empty list.
 void fromBuffer(MVByteBuffer buf)
           
 Serializable get(String key)
          Deprecated. Use getProperty(String key) instead
 Namespace getNamespace()
           
 Serializable getProperty(String key)
          Return the value associated with a key.
 Map<String,Serializable> getPropertyMapRef()
           
 Set<String> keySet()
           
 void put(String key, Serializable val)
          Deprecated. Use setProperty(String key, Serializable val) instead
 void setNamespace(Namespace namespace)
          namespace is used to break up the property namespace.
 void setProperty(String key, Serializable val)
          Associate the value with the key.
(package private)  void setupTransient()
           
 MVByteBuffer toBuffer(String version)
           
 MVByteBuffer toBuffer(String version, Map<String,Serializable> propMap, Set<String> filteredProps)
           
 MVByteBuffer toBuffer(String version, Set<String> filteredProps)
           
 String toString()
           
static Map<String,Serializable> unmarshallProperyMap(MVByteBuffer buffer)
           
 
Methods inherited from class multiverse.msgsys.SubjectMessage
getSubject, setSubject
 
Methods inherited from class multiverse.msgsys.Message
getEnqueueTime, getMsgId, getMsgType, getSenderName, isRPC, setEnqueueTime, setEnqueueTime, setMsgType, toBytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

namespace

private Namespace namespace

lock

protected transient Lock lock

propertyMap

protected Map<String,Serializable> propertyMap

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

MSG_TYPE_PROPERTY

public static MessageType MSG_TYPE_PROPERTY
Constructor Detail

PropertyMessage

public PropertyMessage()

PropertyMessage

public PropertyMessage(MessageType msgType)

PropertyMessage

public PropertyMessage(Long objOid)

PropertyMessage

public PropertyMessage(MessageType msgType,
                       Long objOid)

PropertyMessage

public PropertyMessage(Long objOid,
                       Long notifyOid)
Method Detail

toString

public String toString()
Overrides:
toString in class SubjectMessage

setNamespace

public void setNamespace(Namespace namespace)
namespace is used to break up the property namespace. a single object has multiple property namespaces. this breaks up the object so that different plugins can manage different namespaces. for example, the combat plugin is authoritative for the combatdata namespace. it knows that it can change these values without talking to any other plugins.

Parameters:
namespace - the namespace

getNamespace

public Namespace getNamespace()

put

public void put(String key,
                Serializable val)
Deprecated. Use setProperty(String key, Serializable val) instead

Associate the value with the key.


setProperty

public void setProperty(String key,
                        Serializable val)
Associate the value with the key.

Parameters:
key - A String key.
val - A Serializable value.

get

public Serializable get(String key)
Deprecated. Use getProperty(String key) instead

Get the value associated with a key.


getProperty

public Serializable getProperty(String key)
Return the value associated with a key.

Parameters:
key - A String key.
Returns:
The Serializable value associated with the key, or null if none exists.

keySet

public Set<String> keySet()

toBuffer

public MVByteBuffer toBuffer(String version)

toBuffer

public MVByteBuffer toBuffer(String version,
                             Set<String> filteredProps)

toBuffer

public MVByteBuffer toBuffer(String version,
                             Map<String,Serializable> propMap,
                             Set<String> filteredProps)

fromBuffer

public void fromBuffer(MVByteBuffer buf)

setupTransient

void setupTransient()

getPropertyMapRef

public Map<String,Serializable> getPropertyMapRef()

createPropertyString

public static int createPropertyString(List<String> propStrings,
                                       Map<String,Serializable> propertyMap,
                                       String version)
Input parameter propStrings must be an empty list. This method will fill it with the properties.

Parameters:
propStrings -
Returns:
int

createFilteredPropertyString

public static int createFilteredPropertyString(List<String> propStrings,
                                               Map<String,Serializable> propertyMap,
                                               String version,
                                               Set<String> filteredProps)

addPropertyStringElement

protected static int addPropertyStringElement(String key,
                                              Serializable val,
                                              List<String> propStrings,
                                              String version,
                                              int len)

unmarshallProperyMap

public static Map<String,Serializable> unmarshallProperyMap(MVByteBuffer buffer)