org.red5.server.api

## Interface IAttributeStore

All Superinterfaces:
  AttributeStoreMXBean

All Known Subinterfaces:
  ICastingAttributeStore, IClient, IClientSharedObject, IConnection, IRemotingConnection, IServiceCapableConnection, ISharedObject, ISharedObjectBase, IStreamCapableConnection

All Known Implementing Classes:
  ApplicationAdapter, AttributeStore, BaseConnection, BaseRTMPTConnection, Client, ClientSharedObject, MultiThreadedApplicationAdapter, PersistableAttributeStore, RemotingConnection, RTMPConnection, RTMPMinaConnection, RTMPTConnection, SharedObject, SharedObjectScope, StatefulScopeWrappingAdapter

    public interface IAttributeStore
    extends AttributeStoreMXBean

Base interface for all API objects with attributes

Author:
  The Red5 Project (red5@osflash.org), Luke Hubbard (luke@codegent.com)

### Method Summary

Methods
`Object` `getAttribute(String name)` Return the value for a given attribute.
`Object` `getAttribute(String name, Object defaultValue)` Return the value for a given attribute and set it if it doesn't exist.
`Set<String>` `getAttributeNames()` Get the attribute names.
`Map<String,Object>` `getAttributes()` Get the attributes.
`boolean` `hasAttribute(String name)` Check the object has an attribute.
`boolean` `removeAttribute(String name)` Remove an attribute.
`void` `removeAttributes()` Remove all attributes.
`boolean` `setAttribute(String name, Object value)` Set an attribute on this object.
`void` `setAttributes(IAttributeStore values)` Set multiple attributes on this object.
`void` `setAttributes(Map<String,Object> values)` Set multiple attributes on this object.

### Method Detail

#### getAttributeNames

    Set<String> getAttributeNames()

Get the attribute names. The resulting set will be read-only.

Specified by:
  `getAttributeNames` in interface `AttributeStoreMXBean`
Returns:
  set containing all attribute names

#### getAttributes

    Map<String,Object> getAttributes()

Get the attributes. The resulting map will be read-only.

Returns:
  map containing all attributes

#### setAttribute

    boolean setAttribute(String name,
                       Object value)

Set an attribute on this object.

Parameters:
  `name` - the name of the attribute to change
  `value` - the new value of the attribute
Returns:
  true if the attribute value changed otherwise false

#### setAttributes

    void setAttributes(Map<String,Object> values)

Set multiple attributes on this object.

Parameters:
  `values` - the attributes to set

#### setAttributes

    void setAttributes(IAttributeStore values)

Set multiple attributes on this object.

Parameters:
  `values` - the attributes to set

#### getAttribute

    Object getAttribute(String name)

Return the value for a given attribute.

Parameters:
  `name` - the name of the attribute to get
Returns:
  the attribute value or null if the attribute doesn't exist

#### getAttribute

    Object getAttribute(String name,
                      Object defaultValue)

Return the value for a given attribute and set it if it doesn't exist.

This is a utility function that internally performs the following code:

`if (!hasAttribute(name)) setAttribute(name, defaultValue);
return getAttribute(name);
`

Parameters:
  `name` - the name of the attribute to get
  `defaultValue` - the value of the attribute to set if the attribute doesn't exist
Returns:
  the attribute value

#### hasAttribute

    boolean hasAttribute(String name)

Check the object has an attribute.

Specified by:
  `hasAttribute` in interface `AttributeStoreMXBean`
Parameters:
  `name` - the name of the attribute to check
Returns:
  true if the attribute exists otherwise false

#### removeAttribute

    boolean removeAttribute(String name)

Remove an attribute.

Specified by:
  `removeAttribute` in interface `AttributeStoreMXBean`
Parameters:
  `name` - the name of the attribute to remove
Returns:
  true if the attribute was found and removed otherwise false

#### removeAttributes

    void removeAttributes()

Remove all attributes.

Specified by:
  `removeAttributes` in interface `AttributeStoreMXBean`