net.user1.union.core.attribute
Interface Attribute


public interface Attribute

Attributes are values that can be set on AttributeHolders. When setting an attribute you can set 0 to many flags that will customize how the attribute behaves on the server. You can set more than 1 flag on an attribute using the bitwise OR (|) operator. Example: setAttribute("name", "Chatter", "chatRoom", Attribute.FLAG_SHARED)

See Also:
AttributeHolder

Field Summary
static int FLAG_EVALUATE
          Indicates the value of the attribute should be evaluated as a mathematical expression before assignment.
static int FLAG_IGNORE
           
static int FLAG_IMMUTABLE
          Indicates that once the attribute is set it can no longer be changed.
static int FLAG_NONE
           
static int FLAG_PERSISTENT
          Flags that the attribute should be persisted by a datasource.
static int FLAG_SERVER_ONLY
          Indicates the attribute can be changed only by code on the server (i.e.
static int FLAG_SHARED
          Flags the attribute should be shared.
static int FLAG_SOFTLY_PERSISTENT
          Unsupported in Alpha
static java.lang.String SCOPE_GLOBAL
          Indicates the scope should be global.
 
Method Summary
 int getFlags()
          Returns the flags set for the attribute.
 java.lang.String getName()
          Returns the name of the attribute
 java.lang.String getScope()
          Returns the scope of the attribute.
 java.lang.Object getValue()
          Returns the value of the attribute.
 java.lang.String nullSafeGetValue()
          Returns the value of the attribute as a String by calling the Object toString() method.
 void remove()
          Removes the attribute from its holder (Server, Client, or Room).
 void setFlags(int flags)
          Sets the flags for the attribute.
 void setValue(java.lang.Object value)
          Sets the value of the attribute
 

Field Detail

FLAG_IGNORE

static final int FLAG_IGNORE
See Also:
Constant Field Values

FLAG_NONE

static final int FLAG_NONE
See Also:
Constant Field Values

FLAG_SHARED

static final int FLAG_SHARED
Flags the attribute should be shared. All clients interested in receiving attribute updates will automatically be notified when the attribute changes.

See Also:
Constant Field Values

FLAG_PERSISTENT

static final int FLAG_PERSISTENT
Flags that the attribute should be persisted by a datasource.

See Also:
Constant Field Values

FLAG_IMMUTABLE

static final int FLAG_IMMUTABLE
Indicates that once the attribute is set it can no longer be changed.

See Also:
Constant Field Values

FLAG_SERVER_ONLY

static final int FLAG_SERVER_ONLY
Indicates the attribute can be changed only by code on the server (i.e. not by a remote client).

See Also:
Constant Field Values

FLAG_SOFTLY_PERSISTENT

static final int FLAG_SOFTLY_PERSISTENT
Unsupported in Alpha

See Also:
Constant Field Values

FLAG_EVALUATE

static final int FLAG_EVALUATE
Indicates the value of the attribute should be evaluated as a mathematical expression before assignment. Within the value, the token "%v" represents the attribute's current value. For example, "%v+1" means "increment by one". Supported mathematical operators are: *, /, +, -, %, ., (, and ).

See Also:
Constant Field Values

SCOPE_GLOBAL

static final java.lang.String SCOPE_GLOBAL
Indicates the scope should be global.

See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Returns the name of the attribute

Returns:
the name of the attribute

getScope

java.lang.String getScope()
Returns the scope of the attribute. The scope is context dependent. For client attributes the scope is a room ID.


getFlags

int getFlags()
Returns the flags set for the attribute.

Returns:
the flags set for the attribute

getValue

java.lang.Object getValue()
Returns the value of the attribute.

Returns:
the value of the attribute

nullSafeGetValue

java.lang.String nullSafeGetValue()
Returns the value of the attribute as a String by calling the Object toString() method. For null it returns an empty String.

Returns:
the value of the attribute

setValue

void setValue(java.lang.Object value)
              throws AttributeException
Sets the value of the attribute

Parameters:
value - - the new value of the attribute
Throws:
AttributeException

setFlags

void setFlags(int flags)
              throws AttributeException
Sets the flags for the attribute. To set multiple flags use the bitwise OR (|). For example: setFlags(Attribute.FLAG_SHARED | Attribute.FLAG_PERSISTENT) Changing only the flags of an attribute will not trigger an ATTRIBUTE_CHANGED event.

Parameters:
flags - - the flags for the attribute
Throws:
AttributeException

remove

void remove()
Removes the attribute from its holder (Server, Client, or Room).



Copyright USER1 Subsystems Corporation - Tue Jan 28 2014, 05:05 PM -0500