UnboundID LDAP SDK for Java

LDAP SDK Home Page
Product Information
Using the UnboundID LDAP SDK Persistence Framework

The @LDAPObject Annotation Type

The classes for objects that should be used in conjunction with the UnboundID LDAP SDK persistence framework should be marked with an @LDAPObject annotation which provides information about how objects of that type should be stored in the directory server. Java classes marked with this annotation type must public, must be non-abstract and must have a zero-argument constructor.

Elements that may be present in the @LDAPObject annotation type include:

  • structuralClass -- This element is used to specify the name (or OID) of the structural object class that should be used for entries created from objects that are instances of the marked Java class. If this is not provided, then it will be assumed that the structural object class has the same name as the Java class.

  • auxiliaryClass -- This element is used to specify the names (or OIDs) of any auxiliary object classes that should be used for entries created from objects that are instances of the marked Java class. If this is not provided, then it will be assumed that no auxiliary object classes will be used.

  • postEncodeMethod -- This element is used to specify the name of a Java method contained in the marked class which should be invoked after all other encoding (based on annotated fields and methods in the class) has been performed to construct an LDAP entry that represents the contents of the Java class. This method must take exactly one argument of type com.unboundid.ldap.sdk.Entry. It may alter the contents of the entry in any way, and it may throw any kind of exception to indicate that the entry is not acceptable. If this is not provided, then no post-encode method will be invoked.

  • postDecodeMethod -- This element is used to specify the name of a Java method contained in the marked class which should be invoked after all other decoding (based on annotated fields and methods in the class) has been performed to initialize an instance of the class from an LDAP entry. This method must not take any arguments. It may throw any kind of exception if the decoded object is not valid. If this is not provided, then no post-decode method will be invoked.

  • defaultParentDN -- This element is used to specify the default parent DN for entries created from objects of the associated type if no explicit parent DN is given. If this is not provided, then there will not be a default parent DN and an explicit parent DN should always be provided when it is needed.