|
|||||||||
Atavism Version 2018.1 | AGIS API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatavism.server.objects.NamedPropertyClass
atavism.server.objects.Entity
public class Entity
Entity is the root class of persistable objects in the Atavism 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 atavism.server.objects.NamedPropertyClass |
---|
lock, name |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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 |
Methods inherited from class atavism.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(OID oid)
oid
- OID for the constructed entityMethod Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public 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.Object
public 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 NamedPropertyClass
public java.io.Serializable removeProperty(java.lang.String key)
NamedPropertyClass
removeProperty
in class NamedPropertyClass
key
- serializable key object.
public java.io.Serializable getProperty(java.lang.String key)
getProperty
in class NamedPropertyClass
key
- serializable key object.
java.lang.InterruptedException
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 java.lang.Integer getSubObjectNamespacesInt()
public void setSubObjectNamespacesInt(java.lang.Integer value)
|
Copyright © 2018 Dragonsan Studios Sp. z o.o. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |