Class AddEntry

  • All Implemented Interfaces:
    java.lang.Comparable<GenericEntry>, java.lang.Iterable<Attribute>

    public class AddEntry
    extends ChangeEntry
    An AddEntry is used to store the contents of an entry to add to the directory. It can be generated empty and then filled, or may be loaded from an 'Add' LDIF change-record. Once constructed, it may be applied to a directory, or saved to an LDIF file. Note that only the addAttribute() call is supported, as only add-attributes may be contained within an AddEntry. It cannot include attribute replace or delete operations -- use a ModifyEntry for that.
    Author:
    jp
    • Constructor Detail

      • AddEntry

        public AddEntry​(DN dn)
        Create a new blank AddEntry using the specified DN
        Parameters:
        dn - the distinguished name (must not be null)
        Throws:
        java.lang.NullPointerException - if dn is null
        NativeLibraryException - if an unrecoverable error was detected by the native library
      • AddEntry

        public AddEntry​(Entry entry)
        Create an AddEntry from an Entry.

        Note that any Attributes inside entry which contain no values are treated as if they were not present at all (i.e. they will not appear in the constructed object).

        Parameters:
        entry - the entry from which this object should be created.
        Throws:
        java.lang.NullPointerException - if entry is null
        NativeLibraryException - if an unrecoverable error was detected by the native library
    • Method Detail

      • getChangeIterator

        public java.util.Iterator<Attribute> getChangeIterator()
        Returns an Iterator over the change-attributes associated with this AddEntry. The Iterator will contain only AddAttribute instances, since only AddAttribute instances can be stored in an AddEntry.
        Overrides:
        getChangeIterator in class GenericEntry
        Returns:
        Iterator
      • hasChanges

        public boolean hasChanges()
        Determine whether this entry contains any change-attributes (as would be returned by a call to getChangeIterator()).
        Overrides:
        hasChanges in class GenericEntry
        Returns:
        true if this AddEntry has modifications associated with it, false otherwise.
      • toString

        public java.lang.String toString()
        Returns a String representation of this Entry. The String contains the Entry's DN and a count of the number of attributes that the Entry contains.
        Overrides:
        toString in class ChangeEntry
        Returns:
        a String representation of the Entry.