Class LDAPObjectHandler<T>

java.lang.Object
com.unboundid.ldap.sdk.persist.LDAPObjectHandler<T>
Type Parameters:
T - The type of object handled by this class.
All Implemented Interfaces:
Serializable

This class provides a mechanism for validating, encoding, and decoding objects marked with the LDAPObject annotation type.
See Also:
  • Method Details

    • getType

      @NotNull public Class<T> getType()
      Retrieves the type of object handled by this class.
      Returns:
      The type of object handled by this class.
    • getSuperclassHandler

      Retrieves the LDAPObjectHandler object for the superclass of the associated type, if it is marked with the LDAPObject annotation.
      Returns:
      The LDAPObjectHandler object for the superclass of the associated type, or null if the superclass is not marked with the LDAPObject annotation.
    • getLDAPObjectAnnotation

      Retrieves the LDAPObject annotation for the associated class.
      Returns:
      The LDAPObject annotation for the associated class.
    • getConstructor

      Retrieves the constructor used to create a new instance of the appropriate type.
      Returns:
      The constructor used to create a new instance of the appropriate type.
    • getDNField

      Retrieves the field that will be used to hold the DN of the associated entry, if defined.
      Returns:
      The field that will be used to hold the DN of the associated entry, or null if no DN field is defined in the associated object type.
    • getEntryField

      Retrieves the field that will be used to hold a read-only copy of the entry used to create the object instance, if defined.
      Returns:
      The field that will be used to hold a read-only copy of the entry used to create the object instance, or null if no entry field is defined in the associated object type.
    • getDefaultParentDN

      Retrieves the default parent DN for objects of the associated type.
      Returns:
      The default parent DN for objects of the associated type.
    • getStructuralClass

      Retrieves the name of the structural object class for objects of the associated type.
      Returns:
      The name of the structural object class for objects of the associated type.
    • getAuxiliaryClasses

      Retrieves the names of the auxiliary object classes for objects of the associated type.
      Returns:
      The names of the auxiliary object classes for objects of the associated type. It may be empty if no auxiliary classes are defined.
    • getSuperiorClasses

      Retrieves the names of the superior object classes for objects of the associated type.
      Returns:
      The names of the superior object classes for objects of the associated type. It may be empty if no superior classes are defined.
    • requestAllAttributes

      public boolean requestAllAttributes()
      Indicates whether to request all attributes. This will return true if the associated LDAPObject, or any LDAPObject for any superclass, has requestAllAttributes set to true.
      Returns:
      true if LDAPObject has requestAllAttributes set to true for any class in the hierarchy, or false if not.
    • getAttributesToRequest

      Retrieves the names of the attributes that should be requested when performing a search. It will not include lazily-loaded attributes.
      Returns:
      The names of the attributes that should be requested when performing a search.
    • getLazilyLoadedAttributes

      Retrieves the names of the attributes that should be lazily loaded for objects of this type.
      Returns:
      The names of the attributes that should be lazily loaded for objects of this type. It may be empty if no attributes should be lazily-loaded.
    • getEntryDN

      Retrieves the DN of the entry in which the provided object is stored, if available. The entry DN will not be available if the provided object was not retrieved using the persistence framework, or if the associated class (or one of its superclasses) does not have a field marked with either the LDAPDNField or LDAPEntryField annotation.
      Parameters:
      o - The object for which to retrieve the associated entry DN.
      Returns:
      The DN of the entry in which the provided object is stored, or null if that is not available.
      Throws:
      LDAPPersistException - If a problem occurred while attempting to obtain the entry DN.
    • getEntry

      Retrieves a read-only copy of the entry that was used to initialize the provided object, if available. The entry will only be available if the object was retrieved from the directory using the persistence framework and the associated class (or one of its superclasses) has a field marked with the LDAPEntryField annotation.
      Parameters:
      o - The object for which to retrieve the read-only entry.
      Returns:
      A read-only copy of the entry that was used to initialize the provided object, or null if that is not available.
      Throws:
      LDAPPersistException - If a problem occurred while attempting to obtain the entry DN.
    • getFields

      Retrieves a map of all fields in the class that should be persisted as LDAP attributes. The keys in the map will be the lowercase names of the LDAP attributes used to persist the information, and the values will be information about the fields associated with those attributes.
      Returns:
      A map of all fields in the class that should be persisted as LDAP attributes.
    • getGetters

      Retrieves a map of all getter methods in the class whose values should be persisted as LDAP attributes. The keys in the map will be the lowercase names of the LDAP attributes used to persist the information, and the values will be information about the getter methods associated with those attributes.
      Returns:
      A map of all getter methods in the class whose values should be persisted as LDAP attributes.
    • getSetters

      Retrieves a map of all setter methods in the class that should be invoked with information read from LDAP attributes. The keys in the map will be the lowercase names of the LDAP attributes with the information used to invoke the setter, and the values will be information about the setter methods associated with those attributes.
      Returns:
      A map of all setter methods in the class that should be invoked with information read from LDAP attributes.
    • constructDN

      Determines the DN that should be used for the entry associated with the given object. If the provided object was retrieved from the directory using the persistence framework and has a field with either the LDAPDNField or LDAPEntryField annotation, then the actual DN of the corresponding entry will be returned. Otherwise, it will be constructed using the fields and getter methods marked for inclusion in the entry RDN.
      Parameters:
      o - The object for which to determine the appropriate DN.
      parentDN - The parent DN to use for the constructed DN. If a non-null value is provided, then that value will be used as the parent DN (and the empty string will indicate that the generated DN should not have a parent). If the value is null, then the default parent DN as defined in the LDAPObject annotation will be used. If the provided parent DN is null and the LDAPObject annotation does not specify a default parent DN, then the generated DN will not have a parent.
      Returns:
      The entry DN for the provided object.
      Throws:
      LDAPPersistException - If a problem occurs while obtaining the entry DN, or if the provided parent DN represents an invalid DN.
    • createBaseFilter

      Retrieves a filter that will match any entry containing the structural and auxiliary classes for this object type.
      Returns:
      A filter that will match any entry containing the structural and auxiliary classes for this object type.
    • createFilter

      Retrieves a filter that can be used to search for entries matching the provided object. It will be constructed as an AND search using all fields with a non-null value and that have a LDAPField annotation with the inFilter element set to true, and all getter methods that return a non-null value and have a LDAPGetter annotation with the inFilter element set to true.
      Parameters:
      o - The object for which to create the search filter.
      Returns:
      A filter that can be used to search for entries matching the provided object.
      Throws:
      LDAPPersistException - If it is not possible to construct a search filter for some reason (e.g., because the provided object does not have any non-null fields or getters that are marked for inclusion in filters).