|
|||||||||
| Version 1.5 | APIs subject to change! | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmultiverse.server.objects.NamedPropertyClass
multiverse.server.objects.Entity
public class Entity
Entity is the root class of persistable objects in the Multiverse heirarchy. All entities have a unique object ID (OID). Uniqueness is guaranteed through the OIDManager which typically grabs blocks of unallocated IDs from the database.
Examples of Entities include players, monsters, weapons, armor, quests, and templates. Non-persisted configuration data is typically not an entity.
| Field Summary | |
|---|---|
protected static Logger |
log
Logger for this object, used to log info/debug messages. |
static java.util.concurrent.locks.Lock |
staticLock
Dont use this, will probably be moved. |
protected java.lang.Integer |
subObjectNamespacesInt
This is the set of sub-object namespaces, compressed into an Integer by using one bit for each Namespace. |
protected static java.util.Set<java.lang.Object> |
transientPropertyKeys
A set of key values that are always stored in the transient map; all others are always stored in the persistent map |
protected ObjectType |
type
|
| Fields inherited from class multiverse.server.objects.NamedPropertyClass |
|---|
lock, name |
| Constructor Summary | |
|---|---|
Entity()
Creates an entity and assigns it a new OID. |
|
Entity(java.lang.Long oid)
Creates an entity using the passed in OID. |
|
Entity(java.lang.String name)
Creates an entity with the given name, and assigns it a new OID. |
|
| Method Summary | |
|---|---|
static boolean |
equals(Entity obj1,
Entity obj2)
Returns if two objects are the same - tested by comparing the object id and namespace. |
boolean |
equals(java.lang.Object other)
Returns if two objects are the same - tested by comparing the object id. |
static Entity[] |
getAllEntitiesByNamespace(Namespace namespace)
Deprecated. As of 1.5, use equivalent function on EntityManager. |
static Entity |
getEntityByNamespace(java.lang.Long oid,
Namespace namespace)
Deprecated. As of 1.5, use equivalent function on EntityManager. |
static int |
getEntityCount()
Deprecated. As of 1.5, use equivalent function on EntityManager. |
java.util.concurrent.locks.Lock |
getLock()
Returns the lock for this entity. |
Namespace |
getNamespace()
Returns the namespace containing the entity |
java.lang.Long |
getOid()
Returns OID for this Entity |
boolean |
getPersistenceFlag()
Returns true if the object has been marked persistent. |
java.io.Serializable |
getProperty(java.lang.String key)
If the key is in the transientPropertyKeys set, get the value associated with the key from the transientMap; otherwise get it from the persistent map |
java.util.List<Namespace> |
getSubObjectNamespaces()
Get a list of the sub-object Namespace objects associated with the Entity. |
java.lang.Integer |
getSubObjectNamespacesInt()
Get the subObjectNamespacesInt; exists only to provide a JavaBean interface, so that the database code will persist the Integer. |
java.util.Map<java.lang.String,java.io.Serializable> |
getTransientDataRef()
|
ObjectType |
getType()
Entity object type. |
int |
hashCode()
Returns the OID as hashcode since it is unique. |
boolean |
isDeleted()
|
static void |
registerEntityByNamespace(Entity entity,
Namespace namespace)
Deprecated. As of 1.5, use equivalent function on EntityManager. |
static java.lang.Object |
registerTransientPropertyKey(java.lang.Object key)
Adds an object to the transientPropertyKeys map |
static boolean |
removeEntityByNamespace(Entity entity,
Namespace namespace)
Deprecated. As of 1.5, use equivalent function on EntityManager. |
static boolean |
removeEntityByNamespace(java.lang.Long oid,
Namespace namespace)
Deprecated. As of 1.5, use equivalent function on EntityManager. |
void |
setDeleted()
|
void |
setNamespace(Namespace namespace)
Sets the entity's namespace |
void |
setOid(java.lang.Long oid)
Sets the OID for this entity. |
void |
setPersistenceFlag(boolean flag)
mark this object as being persistent or not. |
java.io.Serializable |
setProperty(java.lang.String key,
java.io.Serializable value)
If the key is in the transientPropertyKeys set, store the key/value pair in the transientMap; otherwise store it in the persistent map |
void |
setSubObjectNamespaces(java.util.Set<Namespace> namespaces)
Set the sub-object Namespace objects associated with the Entity. |
void |
setSubObjectNamespacesInt(java.lang.Integer value)
Set the subObjectNamespacesInt; exists only to provide a JavaBean interface, so that the database code will persist the Integer. |
void |
setType(ObjectType type)
Set the Entity object type. |
byte[] |
toBytes()
Serializes this entity and returns the byte array. |
java.lang.String |
toString()
Returns the string describing this entity, useful for logging. |
static void |
unregisterTransientPropertyKey(java.lang.Object key)
Removes an object to the transientPropertyKeys set |
| Methods inherited from class multiverse.server.objects.NamedPropertyClass |
|---|
getBooleanProperty, getIntProperty, getName, getPropertyMap, getPropertyMapRef, getStringProperty, lock, modifyIntProperty, setName, setPropertyMap, setupTransient, unlock |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static java.util.Set<java.lang.Object> transientPropertyKeys
protected java.lang.Integer subObjectNamespacesInt
protected static final Logger log
protected ObjectType type
public static java.util.concurrent.locks.Lock staticLock
| Constructor Detail |
|---|
public Entity()
public Entity(java.lang.String name)
name - name for the entity.public Entity(java.lang.Long oid)
oid - OID for the constructed entity| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.Long getOid()
public void setOid(java.lang.Long oid)
oid - the OID to set for this entity.public ObjectType getType()
ObjectTypes.unknown if no object type has been set.public void setType(ObjectType type)
public java.util.Map<java.lang.String,java.io.Serializable> getTransientDataRef()
public static boolean equals(Entity obj1,
Entity obj2)
public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic void setPersistenceFlag(boolean flag)
public boolean getPersistenceFlag()
public Namespace getNamespace()
public void setNamespace(Namespace namespace)
public java.util.List<Namespace> getSubObjectNamespaces()
public void setSubObjectNamespaces(java.util.Set<Namespace> namespaces)
namespaces - A list of Namespace objectspublic java.util.concurrent.locks.Lock getLock()
public byte[] toBytes()
public java.io.Serializable setProperty(java.lang.String key,
java.io.Serializable value)
setProperty in class NamedPropertyClasspublic java.io.Serializable getProperty(java.lang.String key)
getProperty in class NamedPropertyClasskey - serializable key object.
NamedPropertyClass.setProperty(String, Serializable)public boolean isDeleted()
public void setDeleted()
public static java.lang.Object registerTransientPropertyKey(java.lang.Object key)
public static void unregisterTransientPropertyKey(java.lang.Object key)
public static Entity getEntityByNamespace(java.lang.Long oid,
Namespace namespace)
EntityManager.
public static void registerEntityByNamespace(Entity entity,
Namespace namespace)
EntityManager.
public static boolean removeEntityByNamespace(Entity entity,
Namespace namespace)
EntityManager.
public static boolean removeEntityByNamespace(java.lang.Long oid,
Namespace namespace)
EntityManager.
public static Entity[] getAllEntitiesByNamespace(Namespace namespace)
EntityManager.
public static int getEntityCount()
EntityManager.
public java.lang.Integer getSubObjectNamespacesInt()
public void setSubObjectNamespacesInt(java.lang.Integer value)
|
Copyright © 2008 The Multiverse Network, Inc. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||