org.red5.server
public class AttributeStore extends Object implements ICastingAttributeStore
Modifier and Type | Field and Description |
---|---|
protected ConcurrentMap<String,Object> |
attributes
Map for attributes
|
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
protected Map<String,Object> |
filterNull(Map<String,Object> values)
Filter
null keys and values from given map. |
static AttributeStore |
from(CompositeData cd)
Allows for reconstruction via CompositeData.
|
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.
|
protected ConcurrentMap<String,Object> attributes
public AttributeStore()
public AttributeStore(Map<String,Object> values)
values
- mappublic AttributeStore(IAttributeStore values)
values
- mapprotected Map<String,Object> filterNull(Map<String,Object> values)
null
keys and values from given map.values
- the map to filterpublic Set<String> getAttributeNames()
getAttributeNames
in interface IAttributeStore
getAttributeNames
in interface AttributeStoreMXBean
public Map<String,Object> getAttributes()
getAttributes
in interface IAttributeStore
public Object getAttribute(String name)
getAttribute
in interface IAttributeStore
name
- the name of the attribute to getpublic Object getAttribute(String name, Object defaultValue)
getAttribute
in interface IAttributeStore
name
- the name of the attribute to getdefaultValue
- the value of the attribute to set if the attribute doesn't
existpublic boolean hasAttribute(String name)
hasAttribute
in interface IAttributeStore
hasAttribute
in interface AttributeStoreMXBean
name
- the name of the attribute to checkpublic boolean setAttribute(String name, Object value)
setAttribute
in interface IAttributeStore
name
- the name of the attribute to changevalue
- the new value of the attributepublic void setAttributes(Map<String,Object> values)
setAttributes
in interface IAttributeStore
values
- the attributes to setpublic void setAttributes(IAttributeStore values)
setAttributes
in interface IAttributeStore
values
- the attributes to setpublic boolean removeAttribute(String name)
removeAttribute
in interface IAttributeStore
removeAttribute
in interface AttributeStoreMXBean
name
- the name of the attribute to removepublic void removeAttributes()
removeAttributes
in interface IAttributeStore
removeAttributes
in interface AttributeStoreMXBean
public Boolean getBoolAttribute(String name)
getBoolAttribute
in interface ICastingAttributeStore
name
- Attribute namepublic Byte getByteAttribute(String name)
getByteAttribute
in interface ICastingAttributeStore
name
- Attribute namepublic Double getDoubleAttribute(String name)
getDoubleAttribute
in interface ICastingAttributeStore
name
- Attribute namepublic Integer getIntAttribute(String name)
getIntAttribute
in interface ICastingAttributeStore
name
- Attribute namepublic List<?> getListAttribute(String name)
getListAttribute
in interface ICastingAttributeStore
name
- Attribute namepublic Long getLongAttribute(String name)
getLongAttribute
in interface ICastingAttributeStore
name
- Attribute namepublic Map<?,?> getMapAttribute(String name)
getMapAttribute
in interface ICastingAttributeStore
name
- Attribute namepublic Set<?> getSetAttribute(String name)
getSetAttribute
in interface ICastingAttributeStore
name
- Attribute namepublic Short getShortAttribute(String name)
getShortAttribute
in interface ICastingAttributeStore
name
- Attribute namepublic String getStringAttribute(String name)
getStringAttribute
in interface ICastingAttributeStore
name
- Attribute namepublic static AttributeStore from(CompositeData cd)
cd
- composite dataCopyright © 2006-2012 The Red5 Project