com.unboundid.ldap.sdk.persist
Annotation Type LDAPSetter


@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface LDAPSetter

This annotation type may be used to mark methods which may be used to set values in the associated object using attributes read from an LDAP directory server. It should only be used for methods in classes that contain the LDAPObject annotation type. Those methods must not be static and must take a single argument, which is the value to set from the corresponding LDAP attribute, but they may have any access modifier (including public, protected, private, or no access modifier at all indicating package-level access). The associated attribute must not be referenced by any other LDAPField or LDAPSetter annotations in the same class, and it may be referenced by at most one LDAPGetter annotation.


Optional Element Summary
 java.lang.String attribute
          The name of the attribute type in which the value of the associated method will be stored.
 java.lang.Class<? extends ObjectEncoder> encoderClass
          The class that provides the logic for encoding the value of this method to an LDAP attribute.
 boolean failOnInvalidValue
          Indicates whether attempts to initialize an object should fail if the LDAP attribute has a value that cannot be represented in the required argument type for the associated method.
 boolean failOnTooManyValues
          Indicates whether attempts to initialize an object should fail if the LDAP attribute has multiple values but the argument for the associated method only accepts a single value.
 

failOnInvalidValue

public abstract boolean failOnInvalidValue
Indicates whether attempts to initialize an object should fail if the LDAP attribute has a value that cannot be represented in the required argument type for the associated method. If this is true, then an exception will be thrown in such instances. If this is false, then the associated method will not be invoked, and attempts to modify the corresponding entry in the directory may cause the existing values to be lost.

Default:
true

failOnTooManyValues

public abstract boolean failOnTooManyValues
Indicates whether attempts to initialize an object should fail if the LDAP attribute has multiple values but the argument for the associated method only accepts a single value. If this is true, then an exception will be thrown in such instances. If this is false, then only the first value returned will be used, and attempts to modify the corresponding entry in the directory may cause those additional values to be lost.

Default:
true

encoderClass

public abstract java.lang.Class<? extends ObjectEncoder> encoderClass
The class that provides the logic for encoding the value of this method to an LDAP attribute.

Default:
com.unboundid.ldap.sdk.persist.DefaultObjectEncoder.class

attribute

public abstract java.lang.String attribute
The name of the attribute type in which the value of the associated method will be stored. If this is not provided, then the method name must start with "set" and it will be assumed that the attribute name is the remainder of the method name.

Default:
""