com.atlassian.crowd.embedded.impl
Class ImmutableAttributes

java.lang.Object
  extended by com.atlassian.crowd.embedded.impl.ImmutableAttributes
All Implemented Interfaces:
Attributes, Serializable

public final class ImmutableAttributes
extends Object
implements Attributes, Serializable

A general purpose immutable implementation of the Attributes interface.

See Also:
Serialized Form

Constructor Summary
ImmutableAttributes()
          Constructs an empty immutable Attributes object.
ImmutableAttributes(Attributes attributes)
          Constructs an immutable copy of the passed in attributes.
ImmutableAttributes(Map<String,Set<String>> attributesMap)
          Constructs an immutable Attributes object from the given Map.
 
Method Summary
 Set<String> getKeys()
          Gets all the keys of the attributes.
 String getValue(String key)
          Returns any value associated with the given key, returns null if there is no value.
 Set<String> getValues(String key)
          Get all the values associated with a given key.
 boolean isEmpty()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImmutableAttributes

public ImmutableAttributes()
Constructs an empty immutable Attributes object.


ImmutableAttributes

public ImmutableAttributes(@NotNull
                           Map<String,Set<String>> attributesMap)
Constructs an immutable Attributes object from the given Map. An immutable copy of the incoming map is built, so the passed map does not need to be immutable itself.

Parameters:
attributesMap - The incoming attributes Map.

ImmutableAttributes

public ImmutableAttributes(@NotNull
                           Attributes attributes)
Constructs an immutable copy of the passed in attributes.

Parameters:
attributes - to clone.
Method Detail

getValues

public Set<String> getValues(String key)
Description copied from interface: Attributes
Get all the values associated with a given key. Duplicate values are not allowed, and this should be enforced case-insensitively to match the behaviour of LDAP servers. Will return null if the key does not exist.

Specified by:
getValues in interface Attributes
Parameters:
key - the key to retrieve the values for
Returns:
the values associated with the given key, or null if the key does not exist.

getValue

public String getValue(String key)
Description copied from interface: Attributes
Returns any value associated with the given key, returns null if there is no value.

Specified by:
getValue in interface Attributes
Parameters:
key - the key to retrieve the value for
Returns:
any value associated with the given key, or null if there is no value

getKeys

public Set<String> getKeys()
Description copied from interface: Attributes
Gets all the keys of the attributes. Warning: case-insensitive keys are currently no enforced, however this is the case for LDAP, so this may be implemented in the future.

Specified by:
getKeys in interface Attributes
Returns:
a set of all the keys.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Attributes
Returns:
true if there are no attributes


Copyright © 2012 Atlassian. All Rights Reserved.