com.slamd.tools.makeldif
Class AttributeList

java.lang.Object
  extended by com.slamd.tools.makeldif.AttributeList

public class AttributeList
extends java.lang.Object

This class defines an attribute list that holds attribute names and values, as well as the separators between them in LDIF output (can be either ": " or ":: " depending on whether the value is base64-encoded or not).

Author:
Neil A. Wilson

Constructor Summary
AttributeList()
          Creates a new attribute list with no attribute information.
 
Method Summary
 void addAttribute(java.lang.String name, java.lang.String lowerName, java.lang.String separator, java.lang.String value)
          Adds a new attribute definition to this attribute list.
 java.lang.String getValue(java.lang.String attributeName)
          Retrieves the value of the specified attribute in this attribute list.
 java.lang.String getValueForLowerName(java.lang.String lowerName)
          Retrieves the value of the specified attribute in this attribute list.
 java.lang.String[] getValues(java.lang.String attributeName)
          Retrieves the set of values for the specified attribute in this attribute list.
 java.lang.String toString()
          Returns a string representation of this attribute list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeList

public AttributeList()
Creates a new attribute list with no attribute information.

Method Detail

addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.String lowerName,
                         java.lang.String separator,
                         java.lang.String value)
Adds a new attribute definition to this attribute list.

Parameters:
name - The name of the attribute to add.
lowerName - The name of the attribute to add, converted to lowercase.
separator - The separator to place between the name and the value in the LDIF output.
value - The value of the attribute to add.

getValue

public java.lang.String getValue(java.lang.String attributeName)
Retrieves the value of the specified attribute in this attribute list. This is used by the attribute replacement code. If the specified attribute has multiple values, then the first value added to the list will be returned. If the specified attribute is not contained in the attribute list, then an empty string will be returned.

Parameters:
attributeName - The name of the attribute for which to retrieve the value.
Returns:
The value of the specified attribute.

getValueForLowerName

public java.lang.String getValueForLowerName(java.lang.String lowerName)
Retrieves the value of the specified attribute in this attribute list. This is used by the attribute replacement code. If the specified attribute has multiple values, then the first value added to the list will be returned. If the specified attribute is not contained in the attribute list, then an empty string will be returned.

Parameters:
lowerName - The name of the attribute for which to retrieve the value, already represented as a lowercase string.
Returns:
The value of the specified attribute.

getValues

public java.lang.String[] getValues(java.lang.String attributeName)
Retrieves the set of values for the specified attribute in this attribute list. If the specified attribute is not contained in the attribute list, then an empty array will be returned.

Parameters:
attributeName - The name of the attribute for which to retrieve the set of values.
Returns:
The set of values for the specified attribute.

toString

public java.lang.String toString()
Returns a string representation of this attribute list. The output will be in LDIF format (but will not have a DN).

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this attribute list.