org.springframework.ldap.odm.core.impl

## Class DefaultObjectDirectoryMapper

- java.lang.Object
- - org.springframework.ldap.odm.core.impl.DefaultObjectDirectoryMapper

- All Implemented Interfaces:
    ObjectDirectoryMapper

      public class DefaultObjectDirectoryMapper
      extends Object
      implements ObjectDirectoryMapper

  Default implementation of `ObjectDirectoryMapper`. Unless you need to explicitly configure converters there is typically no reason to explicitly consider yourself with this class.
  Since:
    2.0
  Author:
    Paul Harvey <paul.at.pauls-place.me.uk>, Mattias Hellborg Arthursson

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultObjectDirectoryMapper()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `attributeFor(Class<?> clazz, String fieldName)` Get the attribute corresponding to the specified field name.
    `Filter` | `filterFor(Class<?> clazz, Filter baseFilter)` Use the specified search filter and return a new one that only applies to entries of the specified class.
    `Name` | `getCalculatedId(Object entry)`
    `Name` | `getId(Object entry)` Get the distinguished name for the specified object.
    `String[]` | `manageClass(Class<?> clazz)` Check if the specified class is already managed by this instance; if not, check the metadata and add the class to the managed classes.
    `<T> T` | `mapFromLdapDataEntry(LdapDataEntry context, Class<T> clazz)` Used to convert from the JNDI LDAP representation of an Entry to the Java representation when reading from LDAP.
    `void` | `mapToLdapDataEntry(Object entry, LdapDataEntry context)` Used to convert from Java representation of an Ldap Entry when writing to the Ldap directory
    `void` | `setConverterManager(ConverterManager converterManager)`
    `void` | `setId(Object entry, Name id)` Set the distinguished name for the specified object.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultObjectDirectoryMapper

          public DefaultObjectDirectoryMapper()

  - ### Method Detail

    - #### setConverterManager

          public void setConverterManager(ConverterManager converterManager)

    - #### manageClass

          public String[] manageClass(Class<?> clazz)

      Description copied from interface: `ObjectDirectoryMapper`
      Check if the specified class is already managed by this instance; if not, check the metadata and add the class to the managed classes.
      Specified by:
        `manageClass` in interface `ObjectDirectoryMapper`
      Parameters:
        `clazz` - the class to manage.
      Returns:
        all relevant attribute names used in the given class (either for reading from LDAP or for writing to LDAP or both)

    - #### mapToLdapDataEntry

          public void mapToLdapDataEntry(Object entry,
                                         LdapDataEntry context)

      Description copied from interface: `ObjectDirectoryMapper`
      Used to convert from Java representation of an Ldap Entry when writing to the Ldap directory
      Specified by:
        `mapToLdapDataEntry` in interface `ObjectDirectoryMapper`
      Parameters:
        `entry` - - The entry to convert.
        `context` - - The LDAP context to store the converted entry

    - #### mapFromLdapDataEntry

          public <T> T mapFromLdapDataEntry(LdapDataEntry context,
                                            Class<T> clazz)

      Description copied from interface: `ObjectDirectoryMapper`
      Used to convert from the JNDI LDAP representation of an Entry to the Java representation when reading from LDAP.
      Specified by:
        `mapFromLdapDataEntry` in interface `ObjectDirectoryMapper`

    - #### getId

          public Name getId(Object entry)

      Description copied from interface: `ObjectDirectoryMapper`
      Get the distinguished name for the specified object.
      Specified by:
        `getId` in interface `ObjectDirectoryMapper`
      Parameters:
        `entry` - the entry to get distinguished name for.
      Returns:
        the distinguished name of the entry.

    - #### setId

          public void setId(Object entry,
                            Name id)

      Description copied from interface: `ObjectDirectoryMapper`
      Set the distinguished name for the specified object.
      Specified by:
        `setId` in interface `ObjectDirectoryMapper`
      Parameters:
        `entry` - the entry to set the name on
        `id` - the name to set

    - #### getCalculatedId

          public Name getCalculatedId(Object entry)

      Specified by:
        `getCalculatedId` in interface `ObjectDirectoryMapper`

    - #### filterFor

          public Filter filterFor(Class<?> clazz,
                                  Filter baseFilter)

      Description copied from interface: `ObjectDirectoryMapper`
      Use the specified search filter and return a new one that only applies to entries of the specified class. In effect this means padding the original filter with an objectclass condition.
      Specified by:
        `filterFor` in interface `ObjectDirectoryMapper`
      Parameters:
        `clazz` - the class.
        `baseFilter` - the filter we want to use.
      Returns:
        the original filter, modified so that it only applies to entries of the specified class.

    - #### attributeFor

          public String attributeFor(Class<?> clazz,
                                     String fieldName)

      Description copied from interface: `ObjectDirectoryMapper`
      Get the attribute corresponding to the specified field name.
      Specified by:
        `attributeFor` in interface `ObjectDirectoryMapper`
      Parameters:
        `clazz` - the clazz.
        `fieldName` - the field name.
      Returns:
        the attribute name.