public class Entity extends NamedPropertyClass implements java.io.Serializable
Examples of Entities include players, monsters, weapons, armor, quests, and templates. Non-persisted configuration data is typically not an entity.
| Modifier and Type | Field and Description |
|---|---|
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 |
lock, name| Constructor and Description |
|---|
Entity()
Creates an entity and assigns it a new OID.
|
Entity(OID 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.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSubObjectNamespace(Namespace namespace) |
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.
|
java.util.concurrent.locks.Lock |
getLock()
Returns the lock for this entity.
|
Namespace |
getNamespace()
Returns the namespace containing the entity
|
OID |
getOid()
Returns OID for this Entity
|
boolean |
getPersistenceFlag()
Returns true if the object has been marked persistent. saved objects
maintain this state
|
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 |
hasSubObjectNamespace(Namespace namespace) |
boolean |
isDeleted() |
static java.lang.Object |
registerTransientPropertyKey(java.lang.Object key)
Adds an object to the transientPropertyKeys map
|
java.io.Serializable |
removeProperty(java.lang.String key)
Remove the named property.
|
void |
removeSubObjectNamespace(Namespace namespace) |
void |
setDeleted() |
void |
setNamespace(Namespace namespace)
Sets the entity's namespace
|
void |
setOid(OID oid)
Sets the OID for this entity.
|
void |
setPersistenceFlag(boolean flag)
mark this object as being persistent or not. other systems will check
this field and save the object to the database when appropriate.
|
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
|
getBooleanProperty, getIntProperty, getName, getPropertyMap, getPropertyMapRef, getStringProperty, lock, modifyIntProperty, setName, setPropertyMap, setupTransient, unlockprotected 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
public Entity()
public Entity(java.lang.String name)
name - name for the entity.public Entity(OID oid)
oid - OID for the constructed entitypublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic OID getOid()
public void setOid(OID 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 void addSubObjectNamespace(Namespace namespace)
public void removeSubObjectNamespace(Namespace namespace)
public boolean hasSubObjectNamespace(Namespace namespace)
public 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 removeProperty(java.lang.String key)
NamedPropertyClassremoveProperty in class NamedPropertyClasskey - serializable key object.public java.io.Serializable getProperty(java.lang.String key)
getProperty in class NamedPropertyClasskey - serializable key object.java.lang.InterruptedExceptionNamedPropertyClass.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 java.lang.Integer getSubObjectNamespacesInt()
public void setSubObjectNamespacesInt(java.lang.Integer value)