Package edu.vt.middleware.ldap.bean
Class AbstractLdapAttributes<T extends java.util.Map<java.lang.String,LdapAttribute>>
- java.lang.Object
-
- edu.vt.middleware.ldap.bean.AbstractLdapBean
-
- edu.vt.middleware.ldap.bean.AbstractLdapAttributes<T>
-
- Type Parameters:
T
- type of backing map
- All Implemented Interfaces:
LdapAttributes
- Direct Known Subclasses:
OrderedLdapBeanFactory.OrderedLdapAttributes
,SortedLdapBeanFactory.SortedLdapAttributes
,UnorderedLdapBeanFactory.UnorderedLdapAttributes
public abstract class AbstractLdapAttributes<T extends java.util.Map<java.lang.String,LdapAttribute>> extends AbstractLdapBean implements LdapAttributes
AbstractLdapAttributes
provides a base implementation ofLdapAttributes
where the underlying attributes are backed by aMap
.- 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 T
attributes
Attributes contained in this bean.static boolean
DEFAULT_IGNORE_CASE
Whether to ignore case when creatingBasicAttributes
.protected static int
HASH_CODE_SEED
hash code seed.-
Fields inherited from class edu.vt.middleware.ldap.bean.AbstractLdapBean
beanFactory, logger
-
-
Constructor Summary
Constructors Constructor Description AbstractLdapAttributes(LdapBeanFactory lbf)
Creates a newAbstractLdapAttributes
with the supplied ldap bean factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(LdapAttribute a)
This adds a new attribute to thisLdapAttributes
.void
addAttribute(java.lang.String name, java.lang.Object value)
This adds a new attribute to thisLdapAttributes
with the supplied name and value.void
addAttribute(java.lang.String name, java.util.List<?> values)
This adds a new attribute to thisLdapAttributes
with the supplied name and values.void
addAttributes(java.util.Collection<LdapAttribute> c)
This adds aCollection
of attributes to thisLdapAttributes
.void
addAttributes(javax.naming.directory.Attributes a)
This adds the attributes in the suppliedAttributes
to thisLdapAttributes
.void
clear()
This removes all attributes from thisLdapAttributes
.LdapAttribute
getAttribute(java.lang.String name)
This returns theLdapAttribute
for thisLdapAttributes
with the supplied name.java.lang.String[]
getAttributeNames()
This returns an array of all the attribute names for thisLdapAttributes
.java.util.Collection<LdapAttribute>
getAttributes()
This returns aCollection
ofLdapAttribute
for thisLdapAttributes
.int
hashCode()
This returns the hash code for this object.void
removeAttribute(LdapAttribute a)
This removes an attribute from thisLdapAttributes
.void
removeAttribute(java.lang.String name)
This removes the attribute with the supplied name.void
removeAttributes(java.util.Collection<LdapAttribute> c)
This removes aCollection
of attributes from thisLdapAttributes
.void
removeAttributes(javax.naming.directory.Attributes a)
This removes the attributes in the suppliedAttributes
from thisLdapAttributes
.int
size()
This returns the number of attributes in this attributes.javax.naming.directory.Attributes
toAttributes()
This returns anAttributes
that represents this entry.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
-
DEFAULT_IGNORE_CASE
public static final boolean DEFAULT_IGNORE_CASE
Whether to ignore case when creatingBasicAttributes
.- See Also:
- Constant Field Values
-
HASH_CODE_SEED
protected static final int HASH_CODE_SEED
hash code seed.- See Also:
- Constant Field Values
-
attributes
protected T extends java.util.Map<java.lang.String,LdapAttribute> attributes
Attributes contained in this bean.
-
-
Constructor Detail
-
AbstractLdapAttributes
public AbstractLdapAttributes(LdapBeanFactory lbf)
Creates a newAbstractLdapAttributes
with the supplied ldap bean factory.- Parameters:
lbf
-LdapBeanFactory
-
-
Method Detail
-
getAttributes
public java.util.Collection<LdapAttribute> getAttributes()
This returns aCollection
ofLdapAttribute
for thisLdapAttributes
.- Specified by:
getAttributes
in interfaceLdapAttributes
- Returns:
List
-
getAttribute
public LdapAttribute getAttribute(java.lang.String name)
This returns theLdapAttribute
for thisLdapAttributes
with the supplied name.- Specified by:
getAttribute
in interfaceLdapAttributes
- Parameters:
name
-String
- Returns:
LdapAttribute
-
getAttributeNames
public java.lang.String[] getAttributeNames()
This returns an array of all the attribute names for thisLdapAttributes
.- Specified by:
getAttributeNames
in interfaceLdapAttributes
- Returns:
String[]
-
addAttribute
public void addAttribute(LdapAttribute a)
This adds a new attribute to thisLdapAttributes
.- Specified by:
addAttribute
in interfaceLdapAttributes
- Parameters:
a
-LdapAttribute
-
addAttribute
public void addAttribute(java.lang.String name, java.lang.Object value)
This adds a new attribute to thisLdapAttributes
with the supplied name and value.- Specified by:
addAttribute
in interfaceLdapAttributes
- Parameters:
name
-String
value
-Object
-
addAttribute
public void addAttribute(java.lang.String name, java.util.List<?> values)
This adds a new attribute to thisLdapAttributes
with the supplied name and values.- Specified by:
addAttribute
in interfaceLdapAttributes
- Parameters:
name
-String
values
-List
-
addAttributes
public void addAttributes(java.util.Collection<LdapAttribute> c)
This adds aCollection
of attributes to thisLdapAttributes
. The collection should containLdapAttribute
objects.- Specified by:
addAttributes
in interfaceLdapAttributes
- Parameters:
c
-Collection
-
addAttributes
public void addAttributes(javax.naming.directory.Attributes a) throws javax.naming.NamingException
This adds the attributes in the suppliedAttributes
to thisLdapAttributes
.- Specified by:
addAttributes
in interfaceLdapAttributes
- Parameters:
a
-Attributes
- Throws:
javax.naming.NamingException
- if the attributes cannot be read
-
removeAttribute
public void removeAttribute(LdapAttribute a)
This removes an attribute from thisLdapAttributes
.- Specified by:
removeAttribute
in interfaceLdapAttributes
- Parameters:
a
-LdapAttribute
-
removeAttribute
public void removeAttribute(java.lang.String name)
This removes the attribute with the supplied name.- Specified by:
removeAttribute
in interfaceLdapAttributes
- Parameters:
name
-String
-
removeAttributes
public void removeAttributes(java.util.Collection<LdapAttribute> c)
This removes aCollection
of attributes from thisLdapAttributes
. The collection should containLdapAttribute
objects.- Specified by:
removeAttributes
in interfaceLdapAttributes
- Parameters:
c
-Collection
-
removeAttributes
public void removeAttributes(javax.naming.directory.Attributes a) throws javax.naming.NamingException
This removes the attributes in the suppliedAttributes
from thisLdapAttributes
.- Specified by:
removeAttributes
in interfaceLdapAttributes
- Parameters:
a
-Attributes
- Throws:
javax.naming.NamingException
- if the attributes cannot be read
-
size
public int size()
This returns the number of attributes in this attributes.- Specified by:
size
in interfaceLdapAttributes
- Returns:
int
-
clear
public void clear()
This removes all attributes from thisLdapAttributes
.- Specified by:
clear
in interfaceLdapAttributes
-
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
-
toAttributes
public javax.naming.directory.Attributes toAttributes()
This returns anAttributes
that represents this entry.- Specified by:
toAttributes
in interfaceLdapAttributes
- Returns:
Attributes
-
-