## org.red5.server
Class AttributeStore

    java.lang.Object
      org.red5.server.AttributeStore

All Implemented Interfaces:
  AttributeStoreMBean, IAttributeStore, ICastingAttributeStore

Direct Known Subclasses:
  BaseConnection, Client, PersistableAttributeStore, SharedObject

    public class AttributeStore

extends Object
implements ICastingAttributeStore

Field Summary
`protected ConcurrentMap<String,Object>` `attributes` Map for attributes

Constructor Summary
`AttributeStore()` Creates empty attribute store.
`AttributeStore(IAttributeStore values)` Creates attribute store with initial values.
`AttributeStore(Map<String,Object> values)` Creates attribute store with initial values.

Method Summary
`protected Map<String,Object>` `filterNull(Map<String,Object> values)` Filter `null` keys and values from given map.
`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` `getBoolAttribute(String name)` Get Boolean attribute by name
`Byte` `getByteAttribute(String name)` Get Byte attribute by name
`Double` `getDoubleAttribute(String name)` Get Double attribute by name
`Integer` `getIntAttribute(String name)` Get Integer attribute by name
`List<?>` `getListAttribute(String name)` Get List attribute by name
`Long` `getLongAttribute(String name)` Get boolean attribute by name
`Map<?,?>` `getMapAttribute(String name)` Get Long attribute by name
`Set<?>` `getSetAttribute(String name)` Get Set attribute by name
`Short` `getShortAttribute(String name)` Get Short attribute by name
`String` `getStringAttribute(String name)` Get String attribute by name
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### attributes

    protected ConcurrentMap<String,Object> attributes

  Map for attributes

Constructor Detail

### AttributeStore

    public AttributeStore()

  Creates empty attribute store. Object is not associated with a persistence storage.

### AttributeStore

    public AttributeStore(Map<String,Object> values)

  Creates attribute store with initial values. Object is not associated with a persistence storage.

  Parameters:
    `values` - map

### AttributeStore

    public AttributeStore(IAttributeStore values)

  Creates attribute store with initial values. Object is not associated with a persistence storage.

  Parameters:
    `values` - map

Method Detail

### filterNull

    protected Map<String,Object> filterNull(Map<String,Object> values)

  Filter `null` keys and values from given map.

  Parameters:
    `values` - the map to filter
  Returns:
    filtered map

### getAttributeNames

    public Set<String> getAttributeNames()

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

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

### getAttributes

    public Map<String,Object> getAttributes()

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

  Specified by:
    `getAttributes` in interface `AttributeStoreMBean`
  Specified by:
    `getAttributes` in interface `IAttributeStore`
  Returns:
    map containing all attributes

### getAttribute

    public Object getAttribute(String name)

  Return the value for a given attribute.

  Specified by:
    `getAttribute` in interface `AttributeStoreMBean`
  Specified by:
    `getAttribute` in interface `IAttributeStore`
  Parameters:
    `name` - the name of the attribute to get
  Returns:
    the attribute value or null if the attribute doesn't exist

### getAttribute

    public Object getAttribute(String name,
                               Object defaultValue)

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

  Specified by:
    `getAttribute` in interface `AttributeStoreMBean`
  Specified by:
    `getAttribute` in interface `IAttributeStore`
  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

    public boolean hasAttribute(String name)

  Check the object has an attribute.

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

### setAttribute

    public boolean setAttribute(String name,
                                Object value)

  Set an attribute on this object.

  Specified by:
    `setAttribute` in interface `AttributeStoreMBean`
  Specified by:
    `setAttribute` in interface `IAttributeStore`
  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

    public void setAttributes(Map<String,Object> values)

  Set multiple attributes on this object.

  Specified by:
    `setAttributes` in interface `IAttributeStore`
  Parameters:
    `values` - the attributes to set

### setAttributes

    public void setAttributes(IAttributeStore values)

  Set multiple attributes on this object.

  Specified by:
    `setAttributes` in interface `IAttributeStore`
  Parameters:
    `values` - the attributes to set

### removeAttribute

    public boolean removeAttribute(String name)

  Remove an attribute.

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

### removeAttributes

    public void removeAttributes()

  Remove all attributes.

  Specified by:
    `removeAttributes` in interface `AttributeStoreMBean`
  Specified by:
    `removeAttributes` in interface `IAttributeStore`

### getBoolAttribute

    public Boolean getBoolAttribute(String name)

  Get Boolean attribute by name

  Specified by:
    `getBoolAttribute` in interface `ICastingAttributeStore`
  Parameters:
    `name` - Attribute name
  Returns:
    Attribute

### getByteAttribute

    public Byte getByteAttribute(String name)

  Get Byte attribute by name

  Specified by:
    `getByteAttribute` in interface `ICastingAttributeStore`
  Parameters:
    `name` - Attribute name
  Returns:
    Attribute

### getDoubleAttribute

    public Double getDoubleAttribute(String name)

  Get Double attribute by name

  Specified by:
    `getDoubleAttribute` in interface `ICastingAttributeStore`
  Parameters:
    `name` - Attribute name
  Returns:
    Attribute

### getIntAttribute

    public Integer getIntAttribute(String name)

  Get Integer attribute by name

  Specified by:
    `getIntAttribute` in interface `ICastingAttributeStore`
  Parameters:
    `name` - Attribute name
  Returns:
    Attribute

### getListAttribute

    public List<?> getListAttribute(String name)

  Get List attribute by name

  Specified by:
    `getListAttribute` in interface `ICastingAttributeStore`
  Parameters:
    `name` - Attribute name
  Returns:
    Attribute

### getLongAttribute

    public Long getLongAttribute(String name)

  Get boolean attribute by name

  Specified by:
    `getLongAttribute` in interface `ICastingAttributeStore`
  Parameters:
    `name` - Attribute name
  Returns:
    Attribute

### getMapAttribute

    public Map<?,?> getMapAttribute(String name)

  Get Long attribute by name

  Specified by:
    `getMapAttribute` in interface `ICastingAttributeStore`
  Parameters:
    `name` - Attribute name
  Returns:
    Attribute

### getSetAttribute

    public Set<?> getSetAttribute(String name)

  Get Set attribute by name

  Specified by:
    `getSetAttribute` in interface `ICastingAttributeStore`
  Parameters:
    `name` - Attribute name
  Returns:
    Attribute

### getShortAttribute

    public Short getShortAttribute(String name)

  Get Short attribute by name

  Specified by:
    `getShortAttribute` in interface `ICastingAttributeStore`
  Parameters:
    `name` - Attribute name
  Returns:
    Attribute

### getStringAttribute

    public String getStringAttribute(String name)

  Get String attribute by name

  Specified by:
    `getStringAttribute` in interface `ICastingAttributeStore`
  Parameters:
    `name` - Attribute name
  Returns:
    Attribute

Copyright © 2006-2010 The Red5 Project