Class DefaultObjectDirectoryMapper
- java.lang.Object
-
- org.springframework.ldap.odm.core.impl.DefaultObjectDirectoryMapper
-
- All Implemented Interfaces:
ObjectDirectoryMapper
public class DefaultObjectDirectoryMapper extends java.lang.Object implements ObjectDirectoryMapper
Default implementation ofObjectDirectoryMapper. Unless you need to explicitly configure converters there is typically no reason to explicitly consider yourself with this class.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description DefaultObjectDirectoryMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringattributeFor(java.lang.Class<?> clazz, java.lang.String fieldName)Get the attribute corresponding to the specified field name.FilterfilterFor(java.lang.Class<?> clazz, Filter baseFilter)Use the specified search filter and return a new one that only applies to entries of the specified class.javax.naming.NamegetCalculatedId(java.lang.Object entry)javax.naming.NamegetId(java.lang.Object entry)Get the distinguished name for the specified object.java.lang.String[]manageClass(java.lang.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> TmapFromLdapDataEntry(LdapDataEntry context, java.lang.Class<T> clazz)Used to convert from the JNDI LDAP representation of an Entry to the Java representation when reading from LDAP.voidmapToLdapDataEntry(java.lang.Object entry, LdapDataEntry context)Used to convert from Java representation of an Ldap Entry when writing to the Ldap directoryvoidsetConverterManager(ConverterManager converterManager)voidsetId(java.lang.Object entry, javax.naming.Name id)Set the distinguished name for the specified object.
-
-
-
Method Detail
-
setConverterManager
public void setConverterManager(ConverterManager converterManager)
-
manageClass
public java.lang.String[] manageClass(java.lang.Class<?> clazz)
Description copied from interface:ObjectDirectoryMapperCheck 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:
manageClassin interfaceObjectDirectoryMapper- 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(java.lang.Object entry, LdapDataEntry context)Description copied from interface:ObjectDirectoryMapperUsed to convert from Java representation of an Ldap Entry when writing to the Ldap directory- Specified by:
mapToLdapDataEntryin interfaceObjectDirectoryMapper- Parameters:
entry- - The entry to convert.context- - The LDAP context to store the converted entry
-
mapFromLdapDataEntry
public <T> T mapFromLdapDataEntry(LdapDataEntry context, java.lang.Class<T> clazz)
Description copied from interface:ObjectDirectoryMapperUsed to convert from the JNDI LDAP representation of an Entry to the Java representation when reading from LDAP.- Specified by:
mapFromLdapDataEntryin interfaceObjectDirectoryMapper
-
getId
public javax.naming.Name getId(java.lang.Object entry)
Description copied from interface:ObjectDirectoryMapperGet the distinguished name for the specified object.- Specified by:
getIdin interfaceObjectDirectoryMapper- Parameters:
entry- the entry to get distinguished name for.- Returns:
- the distinguished name of the entry.
-
setId
public void setId(java.lang.Object entry, javax.naming.Name id)Description copied from interface:ObjectDirectoryMapperSet the distinguished name for the specified object.- Specified by:
setIdin interfaceObjectDirectoryMapper- Parameters:
entry- the entry to set the name onid- the name to set
-
getCalculatedId
public javax.naming.Name getCalculatedId(java.lang.Object entry)
- Specified by:
getCalculatedIdin interfaceObjectDirectoryMapper
-
filterFor
public Filter filterFor(java.lang.Class<?> clazz, Filter baseFilter)
Description copied from interface:ObjectDirectoryMapperUse 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:
filterForin interfaceObjectDirectoryMapper- 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 java.lang.String attributeFor(java.lang.Class<?> clazz, java.lang.String fieldName)Description copied from interface:ObjectDirectoryMapperGet the attribute corresponding to the specified field name.- Specified by:
attributeForin interfaceObjectDirectoryMapper- Parameters:
clazz- the clazz.fieldName- the field name.- Returns:
- the attribute name.
-
-