|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.unboundid.ldap.sdk.persist.LDAPObjectHandler<T>
T
- The type of object handled by this class.@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class LDAPObjectHandler<T>
This class provides a mechanism for validating, encoding, and decoding
objects marked with the LDAPObject
annotation type.
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public java.lang.Class<T> getType()
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.public LDAPObject getLDAPObjectAnnotation()
LDAPObject
annotation for the associated class.
LDAPObject
annotation for the associated class.public java.lang.reflect.Constructor<T> getConstructor()
public java.lang.reflect.Field getDNField()
null
if no DN field is defined in the associated
object type.public java.lang.reflect.Field getEntryField()
null
if no entry
field is defined in the associated object type.public DN getDefaultParentDN()
public java.lang.String getStructuralClass()
public java.lang.String[] getAuxiliaryClasses()
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.public java.lang.String[] getAttributesToRequest()
public java.lang.String[] getLazilyLoadedAttributes()
public java.lang.String getEntryDN(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.public ReadOnlyEntry getEntry(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.public java.util.Map<java.lang.String,FieldInfo> getFields()
public java.util.Map<java.lang.String,GetterInfo> getGetters()
public java.util.Map<java.lang.String,SetterInfo> getSetters()
public java.lang.String constructDN(T o, 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.public Filter createBaseFilter()
public Filter createFilter(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).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |