T
- The type of object handled by this class.@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class LDAPObjectHandler<T> extends java.lang.Object implements java.io.Serializable
LDAPObject
annotation type.Modifier and Type | Method and Description |
---|---|
java.lang.String |
constructDN(T o,
java.lang.String parentDN)
Determines the DN that should be used for the entry associated with the
given object.
|
Filter |
createBaseFilter()
Retrieves a filter that will match any entry containing the structural and
auxiliary classes for this object type.
|
Filter |
createFilter(T o)
Retrieves a filter that can be used to search for entries matching the
provided object.
|
java.lang.String[] |
getAttributesToRequest()
Retrieves the names of the attributes that should be requested when
performing a search.
|
java.lang.String[] |
getAuxiliaryClasses()
Retrieves the names of the auxiliary object classes for objects of the
associated type.
|
java.lang.reflect.Constructor<T> |
getConstructor()
Retrieves the constructor used to create a new instance of the appropriate
type.
|
DN |
getDefaultParentDN()
Retrieves the default parent DN for objects of the associated type.
|
java.lang.reflect.Field |
getDNField()
Retrieves the field that will be used to hold the DN of the associated
entry, if defined.
|
ReadOnlyEntry |
getEntry(T o)
Retrieves a read-only copy of the entry that was used to initialize the
provided object, if available.
|
java.lang.String |
getEntryDN(T o)
Retrieves the DN of the entry in which the provided object is stored, if
available.
|
java.lang.reflect.Field |
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.
|
java.util.Map<java.lang.String,FieldInfo> |
getFields()
Retrieves a map of all fields in the class that should be persisted as LDAP
attributes.
|
java.util.Map<java.lang.String,GetterInfo> |
getGetters()
Retrieves a map of all getter methods in the class whose values should be
persisted as LDAP attributes.
|
java.lang.String[] |
getLazilyLoadedAttributes()
Retrieves the names of the attributes that should be lazily loaded for
objects of this type.
|
LDAPObject |
getLDAPObjectAnnotation()
Retrieves the
LDAPObject annotation for the associated class. |
java.util.Map<java.lang.String,SetterInfo> |
getSetters()
Retrieves a map of all setter methods in the class that should be invoked
with information read from LDAP attributes.
|
java.lang.String |
getStructuralClass()
Retrieves the name of the structural object class for objects of the
associated type.
|
LDAPObjectHandler<?> |
getSuperclassHandler()
Retrieves the
LDAPObjectHandler object for the superclass of the
associated type, if it is marked with the LDAPObject annotation . |
java.lang.String[] |
getSuperiorClasses()
Retrieves the names of the superior object classes for objects of the
associated type.
|
java.lang.Class<T> |
getType()
Retrieves the type of object handled by this class.
|
boolean |
requestAllAttributes()
Indicates whether to request all attributes.
|
@NotNull public java.lang.Class<T> getType()
@Nullable public LDAPObjectHandler<?> getSuperclassHandler()
LDAPObjectHandler
object for the superclass of the
associated type, if it is marked with the LDAPObject annotation
.LDAPObjectHandler
object for the superclass of the
associated type, or null
if the superclass is not marked
with the LDAPObject
annotation.@NotNull public LDAPObject getLDAPObjectAnnotation()
LDAPObject
annotation for the associated class.LDAPObject
annotation for the associated class.@NotNull public java.lang.reflect.Constructor<T> getConstructor()
@Nullable public java.lang.reflect.Field getDNField()
null
if no DN field is defined in the associated
object type.@Nullable public java.lang.reflect.Field getEntryField()
null
if no entry
field is defined in the associated object type.@NotNull public DN getDefaultParentDN()
@NotNull public java.lang.String getStructuralClass()
@NotNull public java.lang.String[] getAuxiliaryClasses()
@NotNull public java.lang.String[] getSuperiorClasses()
public boolean requestAllAttributes()
true
if the associated LDAPObject
, or any LDAPObject
for any
superclass, has requestAllAttributes
set to true
.true
if LDAPObject
has
requestAllAttributes
set to true
for any class in
the hierarchy, or false
if not.@NotNull public java.lang.String[] getAttributesToRequest()
@NotNull public java.lang.String[] getLazilyLoadedAttributes()
@Nullable public java.lang.String getEntryDN(@NotNull T o) throws LDAPPersistException
LDAPDNField
or LDAPEntryField
annotation.o
- The object for which to retrieve the associated entry DN.null
if that is not available.LDAPPersistException
- If a problem occurred while attempting to
obtain the entry DN.@Nullable public ReadOnlyEntry getEntry(@NotNull T o) throws LDAPPersistException
LDAPEntryField
annotation.o
- The object for which to retrieve the read-only entry.null
if that is not available.LDAPPersistException
- If a problem occurred while attempting to
obtain the entry DN.@NotNull public java.util.Map<java.lang.String,FieldInfo> getFields()
@NotNull public java.util.Map<java.lang.String,GetterInfo> getGetters()
@NotNull public java.util.Map<java.lang.String,SetterInfo> getSetters()
@NotNull public java.lang.String constructDN(@NotNull T o, @Nullable java.lang.String parentDN) throws LDAPPersistException
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.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.LDAPPersistException
- If a problem occurs while obtaining the
entry DN, or if the provided parent DN
represents an invalid DN.@NotNull public Filter createBaseFilter()
@NotNull public Filter createFilter(@NotNull T o) throws LDAPPersistException
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
.o
- The object for which to create the search filter.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).