org.n52.security.common.attributes
Class Attributes

java.lang.Object
  extended by org.n52.security.common.attributes.Attributes
All Implemented Interfaces:
java.io.Serializable

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

Class Attributes are collections of attributes.

Version:
$Revision: $
Author:
Marko Reiprecht Created on 05.08.2008
See Also:
Serialized Form

Field Summary
protected  java.util.Map m_attributes
           
 
Constructor Summary
Attributes()
          Constructor creates a new instance.
Attributes(java.util.Collection attributes)
          Constructor creates a new instance.
 
Method Summary
 boolean containsAttribute(java.lang.String key)
          Returns true if an attribute with the given key is present.
 boolean equals(java.lang.Object o)
          Method equals.
 Attribute getAttribute(java.lang.String key)
          Gets an Attribute for a given key.
 java.util.Set getAttributeNames()
          Gets the attribute names.
 java.util.Collection getAttributes()
          Gets the attributes.
 java.lang.String getStringAttributeValue(java.lang.String key)
          Gets the value of an Attribute with StringAttributeValue.
 int hashCode()
          Method hashCode.
 boolean isEmpty()
          Method says if environment is empty.
 Attributes putAttribute(Attribute attribute)
          Method puts an attribute in the environment.
 Attributes putAttribute(java.lang.String key, java.lang.String value)
          Method puts a simple StringAttribute in the environment.
 Attributes putAttributes(java.util.Collection attributes)
          Method puts a collection of attributes in the environment.
 Attributes removeAttribute(Attribute attribute)
          Method removes the attribute from the environment.
 Attributes removeAttribute(java.lang.String key)
          Method removes the attribute with the given key.
 Attributes removeAttributes(java.util.Collection attributes)
          Method removes all attributes in the collection.
 int size()
          Method gets the size.
 java.lang.String toString()
          Method toString.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_attributes

protected java.util.Map m_attributes
Constructor Detail

Attributes

public Attributes()
Constructor creates a new instance.


Attributes

public Attributes(java.util.Collection attributes)
Constructor creates a new instance.

Parameters:
attributes - the attributes.
Method Detail

getAttributes

public java.util.Collection getAttributes()
Gets the attributes. The collection is unmodifiable.

Returns:
returns the attributes.

getAttributeNames

public java.util.Set getAttributeNames()
Gets the attribute names.

Returns:
returns the attributenames.

isEmpty

public boolean isEmpty()
Method says if environment is empty.

Returns:
boolean.

equals

public boolean equals(java.lang.Object o)
Method equals.

Overrides:
equals in class java.lang.Object
Parameters:
o - the o.
Returns:
boolean.

hashCode

public int hashCode()
Method hashCode.

Overrides:
hashCode in class java.lang.Object
Returns:
int.

toString

public java.lang.String toString()
Method toString.

Overrides:
toString in class java.lang.Object
Returns:
String.

getAttribute

public Attribute getAttribute(java.lang.String key)
Gets an Attribute for a given key.

Parameters:
key - the key of the attribute.
Returns:
the found attribute or null if nothing is found.

getStringAttributeValue

public java.lang.String getStringAttributeValue(java.lang.String key)
Gets the value of an Attribute with StringAttributeValue.

Parameters:
key - the key of the attribute.
Returns:
the found attribute value or null if not set.

containsAttribute

public boolean containsAttribute(java.lang.String key)
Returns true if an attribute with the given key is present.

Parameters:
key - a key, asserted to be not null.
Returns:
true if attribute with key is present.

putAttribute

public Attributes putAttribute(Attribute attribute)
Method puts an attribute in the environment.

Parameters:
attribute - the attribute.
Returns:
Environment.

putAttribute

public Attributes putAttribute(java.lang.String key,
                               java.lang.String value)
Method puts a simple StringAttribute in the environment.

Parameters:
key - the key.
value - the value.
Returns:
Environment.

putAttributes

public Attributes putAttributes(java.util.Collection attributes)
Method puts a collection of attributes in the environment.

Parameters:
attributes - the attributes.
Returns:
Environment.

removeAttribute

public Attributes removeAttribute(java.lang.String key)
Method removes the attribute with the given key.

Parameters:
key - the key.
Returns:
Environment.

removeAttributes

public Attributes removeAttributes(java.util.Collection attributes)
Method removes all attributes in the collection.

Parameters:
attributes - the attributes.
Returns:
Environment.

removeAttribute

public Attributes removeAttribute(Attribute attribute)
Method removes the attribute from the environment.

Parameters:
attribute - the attribute.
Returns:
Environment.

size

public int size()
Method gets the size.

Returns:
int.


Copyright © 2004-2009 52north.org. All Rights Reserved.