Atavism Version 2018.1AGIS API

atavism.server.objects
Class NamedPropertyClass

java.lang.Object
  extended by atavism.server.objects.NamedPropertyClass
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Entity, Template

public class NamedPropertyClass
extends java.lang.Object
implements java.io.Serializable

A base class for classes the require a name and a set of properties, but which is not persistable

See Also:
Serialized Form

Field Summary
protected  java.util.concurrent.locks.Lock lock
          Lock to protect the property map
protected  java.lang.String name
           
 
Constructor Summary
NamedPropertyClass()
           
NamedPropertyClass(java.lang.String name)
           
 
Method Summary
 boolean getBooleanProperty(java.lang.String key)
          if null, returns false
 java.lang.Integer getIntProperty(java.lang.String key)
           
 java.lang.String getName()
          Returns the name of this entity.
 java.io.Serializable getProperty(java.lang.String key)
          Returns the property named by key.
 java.util.Map<java.lang.String,java.io.Serializable> getPropertyMap()
          For java beans xml serialization, not for general consumption.
 java.util.Map<java.lang.String,java.io.Serializable> getPropertyMapRef()
           
 java.lang.String getStringProperty(java.lang.String key)
           
 void lock()
           
 java.lang.Integer modifyIntProperty(java.lang.String key, int delta)
          Helper method for entity properties.
 java.io.Serializable removeProperty(java.lang.String key)
          Remove the named property.
 void setName(java.lang.String name)
          Sets the name for this entity.
 java.io.Serializable setProperty(java.lang.String key, java.io.Serializable value)
          Sets a property (name/value pair) to this entity.
 void setPropertyMap(java.util.Map<java.lang.String,java.io.Serializable> propMap)
          For java beans xml serialization, not for general consumption.
protected  void setupTransient()
           
 void unlock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

protected transient java.util.concurrent.locks.Lock lock
Lock to protect the property map


name

protected java.lang.String name
Constructor Detail

NamedPropertyClass

public NamedPropertyClass()

NamedPropertyClass

public NamedPropertyClass(java.lang.String name)
Method Detail

setupTransient

protected void setupTransient()

getName

public java.lang.String getName()
Returns the name of this entity.

Returns:
name for this entity.

setName

public void setName(java.lang.String name)
Sets the name for this entity.

Parameters:
name - name for this entity.

setProperty

public java.io.Serializable setProperty(java.lang.String key,
                                        java.io.Serializable value)
Sets a property (name/value pair) to this entity. This is useful for attributes like strength, intelligence, state information. The key parameter must be a string and the value parameter must be serializable. When saving the entity to the database or serializing the object over the network, all of its properties will also be serialized.

If you have an accessor method to a property like getDisplayContext() and setDisplayContext() make sure to set it up as transient with the Introspector's BeanInfo object. See AOObject static initialization block for an example.

Returns:
old value for given key or null if none ever set.

getProperty

public java.io.Serializable getProperty(java.lang.String key)
Returns the property named by key.

Parameters:
key - serializable key object.
Returns:
value of the property, null if property does not exist.
Throws:
java.lang.InterruptedException
See Also:
setProperty(String, Serializable)

removeProperty

public java.io.Serializable removeProperty(java.lang.String key)
Remove the named property.

Parameters:
key - serializable key object.
Returns:
old value for given key or null if none ever set.

getStringProperty

public java.lang.String getStringProperty(java.lang.String key)

getBooleanProperty

public boolean getBooleanProperty(java.lang.String key)
if null, returns false

Throws:
java.lang.InterruptedException

getIntProperty

public java.lang.Integer getIntProperty(java.lang.String key)

modifyIntProperty

public java.lang.Integer modifyIntProperty(java.lang.String key,
                                           int delta)
Helper method for entity properties. Atomically modified an integer value property by delta. newval = oldval + delta. delta can be negative.

Parameters:
key - key for property
delta - amount changed, can be negative.
Returns:
new value.

getPropertyMap

public java.util.Map<java.lang.String,java.io.Serializable> getPropertyMap()
For java beans xml serialization, not for general consumption.


setPropertyMap

public void setPropertyMap(java.util.Map<java.lang.String,java.io.Serializable> propMap)
For java beans xml serialization, not for general consumption.


getPropertyMapRef

public java.util.Map<java.lang.String,java.io.Serializable> getPropertyMapRef()

lock

public void lock()

unlock

public void unlock()


Copyright © 2018 Dragonsan Studios Sp. z o.o.