org.apache.directory.shared.ldap.util
Class AttributeUtils

java.lang.Object
  extended byorg.apache.directory.shared.ldap.util.AttributeUtils

public class AttributeUtils
extends java.lang.Object

A set of utility fuctions for working with Attributes.

Version:
$Rev: 379008 $
Author:
Apache Directory Project

Constructor Summary
AttributeUtils()
           
 
Method Summary
static boolean containsAnyValues(javax.naming.directory.Attribute attr, java.lang.Object[] compared, AttributeType type)
           
static boolean containsValue(javax.naming.directory.Attribute attr, java.lang.Object compared, AttributeType type)
           
static javax.naming.directory.Attribute getDifference(javax.naming.directory.Attribute attr0, javax.naming.directory.Attribute attr1)
          Creates a new attribute which contains the values representing the difference of two attributes.
static javax.naming.directory.Attribute getUnion(javax.naming.directory.Attribute attr0, javax.naming.directory.Attribute attr1)
          Creates a new attribute which contains the values representing the union of two attributes.
static java.lang.String toString(javax.naming.directory.Attributes attributes)
          Return a string representing the attributes
static java.lang.String toString(java.lang.String tabs, javax.naming.directory.Attributes attributes)
          Return a string representing the attributes with tabs in front of the string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeUtils

public AttributeUtils()
Method Detail

containsValue

public static boolean containsValue(javax.naming.directory.Attribute attr,
                                    java.lang.Object compared,
                                    AttributeType type)
                             throws javax.naming.NamingException
Throws:
javax.naming.NamingException

containsAnyValues

public static boolean containsAnyValues(javax.naming.directory.Attribute attr,
                                        java.lang.Object[] compared,
                                        AttributeType type)
                                 throws javax.naming.NamingException
Throws:
javax.naming.NamingException

getDifference

public static javax.naming.directory.Attribute getDifference(javax.naming.directory.Attribute attr0,
                                                             javax.naming.directory.Attribute attr1)
                                                      throws javax.naming.NamingException
Creates a new attribute which contains the values representing the difference of two attributes. If both attributes are null then we cannot determine the attribute ID and an IllegalArgumentException is raised. Note that the order of arguments makes a difference.

Parameters:
attr0 - the first attribute
attr1 - the second attribute
Returns:
a new attribute with the difference of values from both attribute arguments
Throws:
javax.naming.NamingException - if there are problems accessing attribute values

getUnion

public static javax.naming.directory.Attribute getUnion(javax.naming.directory.Attribute attr0,
                                                        javax.naming.directory.Attribute attr1)
                                                 throws javax.naming.NamingException
Creates a new attribute which contains the values representing the union of two attributes. If one attribute is null then the resultant attribute returned is a copy of the non-null attribute. If both are null then we cannot determine the attribute ID and an IllegalArgumentException is raised.

Parameters:
attr0 - the first attribute
attr1 - the second attribute
Returns:
a new attribute with the union of values from both attribute arguments
Throws:
javax.naming.NamingException - if there are problems accessing attribute values

toString

public static java.lang.String toString(java.lang.String tabs,
                                        javax.naming.directory.Attributes attributes)
Return a string representing the attributes with tabs in front of the string

Parameters:
tabs - Spaces to be added before the string
attributes - The attributes to print
Returns:
A string

toString

public static java.lang.String toString(javax.naming.directory.Attributes attributes)
Return a string representing the attributes

Parameters:
attributes - The attributes to print
Returns:
A string


Copyright © 2003-2006 . All Rights Reserved.