public abstract class AbstractEntity extends java.lang.Object implements Entity
Modifier | Constructor and Description |
---|---|
protected |
AbstractEntity(AbstractEntity other)
AbstractEntity copy constructor.
|
protected |
AbstractEntity(EntityID id)
Construct an AbstractEntity with a set of properties.
|
Modifier and Type | Method and Description |
---|---|
void |
addEntityListener(EntityListener l)
Add an EntityListener.
|
Entity |
copy()
Create a copy of this entity.
|
protected abstract Entity |
copyImpl()
Create a copy of this entity.
|
boolean |
equals(java.lang.Object o) |
protected void |
firePropertyChanged(Property p,
java.lang.Object oldValue,
java.lang.Object newValue)
Notify all listeners that a property has changed.
|
protected java.lang.String |
getEntityName()
Get the name of this entity.
|
java.lang.String |
getFullDescription()
Get the full description of this object.
|
EntityID |
getID()
Get the ID of this Entity.
|
java.util.Set<Property> |
getProperties()
Get all the properties that this entity has.
|
Property |
getProperty(java.lang.String propertyURN)
Get a property by urn.
|
int |
hashCode() |
void |
read(java.io.InputStream in)
Read this Entity from a stream.
|
protected void |
registerProperties(Property... props)
Register a set of properties.
|
void |
removeEntityListener(EntityListener l)
Remove an EntityListener.
|
java.lang.String |
toString() |
void |
write(java.io.OutputStream out)
Write this Entity to a stream.
|
protected AbstractEntity(EntityID id)
id
- The ID of this entity.protected AbstractEntity(AbstractEntity other)
other
- The AbstractEntity to copy.public void addEntityListener(EntityListener l)
Entity
addEntityListener
in interface Entity
l
- The listener to add.public void removeEntityListener(EntityListener l)
Entity
removeEntityListener
in interface Entity
l
- The listener to remove.protected abstract Entity copyImpl()
public final java.util.Set<Property> getProperties()
Entity
getProperties
in interface Entity
public Property getProperty(java.lang.String propertyURN)
Entity
getProperty
in interface Entity
propertyURN
- The urn to look up.public void write(java.io.OutputStream out) throws java.io.IOException
Entity
public void read(java.io.InputStream in) throws java.io.IOException
Entity
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getFullDescription()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
protected java.lang.String getEntityName()
protected void registerProperties(Property... props)
props
- The properties to register.protected void firePropertyChanged(Property p, java.lang.Object oldValue, java.lang.Object newValue)
p
- The changed property.oldValue
- The old value.newValue
- The new value.