edu.vt.middleware.ldap.bean
Class AbstractLdapAttribute<T extends Set<Object>>

java.lang.Object
  extended by edu.vt.middleware.ldap.bean.AbstractLdapBean
      extended by edu.vt.middleware.ldap.bean.AbstractLdapAttribute<T>
Type Parameters:
T - type of backing set
All Implemented Interfaces:
LdapAttribute
Direct Known Subclasses:
OrderedLdapBeanFactory.OrderedLdapAttribute, SortedLdapBeanFactory.SortedLdapAttribute, UnorderedLdapBeanFactory.UnorderedLdapAttribute

public abstract class AbstractLdapAttribute<T extends Set<Object>>
extends AbstractLdapBean
implements LdapAttribute

AbstractLdapAttribute provides a base implementation of LdapAttribute where the underlying values are backed by a Set.

Version:
$Revision: 1330 $ $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
Author:
Middleware Services

Field Summary
protected static int HASH_CODE_SEED
          hash code seed.
protected  String name
          Name for this attribute.
protected  Set<Object> values
          Values for this attribute.
 
Fields inherited from class edu.vt.middleware.ldap.bean.AbstractLdapBean
beanFactory, logger
 
Constructor Summary
AbstractLdapAttribute(LdapBeanFactory lbf)
          Creates a new AbstractLdapAttribute with the supplied ldap bean factory.
 
Method Summary
protected  void convertValuesToString(Set<String> stringValues)
          Converts the underlying set of objects to a set of strings.
 String getName()
          This returns the name of this LdapAttribute.
abstract  Set<String> getStringValues()
          This returns the value(s) of this LdapAttribute Values are encoded in base64 format if the underlying value is of type byte[].
 Set<Object> getValues()
          This returns the value(s) of this LdapAttribute.
 int hashCode()
          This returns the hash code for this object.
 void setAttribute(Attribute attribute)
          This sets this LdapAttribute using the supplied attribute.
 void setName(String name)
          This sets the name of this LdapAttribute.
 Attribute toAttribute()
          This returns an Attribute that represents the values in this LdapAttribute.
 String toString()
          This returns a string representation of this object.
 
Methods inherited from class edu.vt.middleware.ldap.bean.AbstractLdapBean
equals
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

HASH_CODE_SEED

protected static final int HASH_CODE_SEED
hash code seed.

See Also:
Constant Field Values

name

protected String name
Name for this attribute.


values

protected Set<Object> values
Values for this attribute.

Constructor Detail

AbstractLdapAttribute

public AbstractLdapAttribute(LdapBeanFactory lbf)
Creates a new AbstractLdapAttribute with the supplied ldap bean factory.

Parameters:
lbf - LdapBeanFactory
Method Detail

getName

public String getName()
This returns the name of this LdapAttribute.

Specified by:
getName in interface LdapAttribute
Returns:
String

getValues

public Set<Object> getValues()
This returns the value(s) of this LdapAttribute.

Specified by:
getValues in interface LdapAttribute
Returns:
Set

getStringValues

public abstract Set<String> getStringValues()
This returns the value(s) of this LdapAttribute Values are encoded in base64 format if the underlying value is of type byte[]. The returned set is unmodifiable.

Specified by:
getStringValues in interface LdapAttribute
Returns:
unmodifiable Set

setAttribute

public void setAttribute(Attribute attribute)
                  throws NamingException
This sets this LdapAttribute using the supplied attribute.

Specified by:
setAttribute in interface LdapAttribute
Parameters:
attribute - Attribute
Throws:
NamingException - if the attribute values cannot be read

setName

public void setName(String name)
This sets the name of this LdapAttribute.

Specified by:
setName in interface LdapAttribute
Parameters:
name - String

hashCode

public int hashCode()
This returns the hash code for this object.

Specified by:
hashCode in class AbstractLdapBean
Returns:
int

toString

public String toString()
This returns a string representation of this object.

Overrides:
toString in class Object
Returns:
String

toAttribute

public Attribute toAttribute()
This returns an Attribute that represents the values in this LdapAttribute.

Specified by:
toAttribute in interface LdapAttribute
Returns:
Attribute

convertValuesToString

protected void convertValuesToString(Set<String> stringValues)
Converts the underlying set of objects to a set of strings. Objects of type byte[] are base64 encoded. Objects which are not of type String or byte[] are converted using Object.toString().

Parameters:
stringValues - Set to populate with strings


Copyright © 2003-2010 Virginia Tech. All Rights Reserved.