Package edu.vt.middleware.ldap.bean
Class AbstractLdapAttribute<T extends java.util.Set<java.lang.Object>>
- java.lang.Object
-
- edu.vt.middleware.ldap.bean.AbstractLdapBean
-
- 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 java.util.Set<java.lang.Object>> extends AbstractLdapBean implements LdapAttribute
AbstractLdapAttribute
provides a base implementation ofLdapAttribute
where the underlying values are backed by aSet
.- Version:
- $Revision: 1330 $ $Date: 2010-05-24 00:10:53 +0200 (Mon, 24 May 2010) $
- Author:
- Middleware Services
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
HASH_CODE_SEED
hash code seed.protected java.lang.String
name
Name for this attribute.protected java.util.Set<java.lang.Object>
values
Values for this attribute.-
Fields inherited from class edu.vt.middleware.ldap.bean.AbstractLdapBean
beanFactory, logger
-
-
Constructor Summary
Constructors Constructor Description AbstractLdapAttribute(LdapBeanFactory lbf)
Creates a newAbstractLdapAttribute
with the supplied ldap bean factory.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
convertValuesToString(java.util.Set<java.lang.String> stringValues)
Converts the underlying set of objects to a set of strings.java.lang.String
getName()
This returns the name of thisLdapAttribute
.abstract java.util.Set<java.lang.String>
getStringValues()
This returns the value(s) of thisLdapAttribute
Values are encoded in base64 format if the underlying value is of type byte[].java.util.Set<java.lang.Object>
getValues()
This returns the value(s) of thisLdapAttribute
.int
hashCode()
This returns the hash code for this object.void
setAttribute(javax.naming.directory.Attribute attribute)
This sets thisLdapAttribute
using the supplied attribute.void
setName(java.lang.String name)
This sets the name of thisLdapAttribute
.javax.naming.directory.Attribute
toAttribute()
This returns anAttribute
that represents the values in thisLdapAttribute
.java.lang.String
toString()
This returns a string representation of this object.-
Methods inherited from class edu.vt.middleware.ldap.bean.AbstractLdapBean
equals
-
-
-
-
Field Detail
-
HASH_CODE_SEED
protected static final int HASH_CODE_SEED
hash code seed.- See Also:
- Constant Field Values
-
name
protected java.lang.String name
Name for this attribute.
-
values
protected java.util.Set<java.lang.Object> values
Values for this attribute.
-
-
Constructor Detail
-
AbstractLdapAttribute
public AbstractLdapAttribute(LdapBeanFactory lbf)
Creates a newAbstractLdapAttribute
with the supplied ldap bean factory.- Parameters:
lbf
-LdapBeanFactory
-
-
Method Detail
-
getName
public java.lang.String getName()
This returns the name of thisLdapAttribute
.- Specified by:
getName
in interfaceLdapAttribute
- Returns:
String
-
getValues
public java.util.Set<java.lang.Object> getValues()
This returns the value(s) of thisLdapAttribute
.- Specified by:
getValues
in interfaceLdapAttribute
- Returns:
Set
-
getStringValues
public abstract java.util.Set<java.lang.String> getStringValues()
This returns the value(s) of thisLdapAttribute
Values are encoded in base64 format if the underlying value is of type byte[]. The returned set is unmodifiable.- Specified by:
getStringValues
in interfaceLdapAttribute
- Returns:
- unmodifiable
Set
-
setAttribute
public void setAttribute(javax.naming.directory.Attribute attribute) throws javax.naming.NamingException
This sets thisLdapAttribute
using the supplied attribute.- Specified by:
setAttribute
in interfaceLdapAttribute
- Parameters:
attribute
-Attribute
- Throws:
javax.naming.NamingException
- if the attribute values cannot be read
-
setName
public void setName(java.lang.String name)
This sets the name of thisLdapAttribute
.- Specified by:
setName
in interfaceLdapAttribute
- Parameters:
name
-String
-
hashCode
public int hashCode()
This returns the hash code for this object.- Specified by:
hashCode
in classAbstractLdapBean
- Returns:
int
-
toString
public java.lang.String toString()
This returns a string representation of this object.- Overrides:
toString
in classjava.lang.Object
- Returns:
String
-
toAttribute
public javax.naming.directory.Attribute toAttribute()
This returns anAttribute
that represents the values in thisLdapAttribute
.- Specified by:
toAttribute
in interfaceLdapAttribute
- Returns:
Attribute
-
convertValuesToString
protected void convertValuesToString(java.util.Set<java.lang.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
-
-