Package com.unboundid.ldap.sdk.persist
Annotation Type 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
Optional ElementsModifier and TypeOptional ElementDescriptionThe name of the attribute type in which the value of the associated method will be stored.Class<? extends ObjectEncoder> The class that provides the logic for encoding the value of this method to an LDAP attribute.booleanIndicates 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.booleanIndicates 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.
-
Element Details
-
failOnInvalidValue
boolean failOnInvalidValueIndicates 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 istrue, then an exception will be thrown in such instances. If this isfalse, 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.- Returns:
trueif attempts to initialize an object should fail if the LDAP attribute has a value that cannot be represented in the required argument type, orfalseif not.
- Default:
true
-
failOnTooManyValues
boolean failOnTooManyValuesIndicates 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 istrue, then an exception will be thrown in such instances. If this isfalse, 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.- Returns:
trueif 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, orfalseif not.
- Default:
true
-
encoderClass
The class that provides the logic for encoding the value of this method to an LDAP attribute.- Returns:
- The encoder class for this method.
- Default:
com.unboundid.ldap.sdk.persist.DefaultObjectEncoder.class
-
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.- Returns:
- The name of the attribute type in which the value of the associated method will be stored, or an empty string if the attribute name will be assumed to match the method name minus the initial "set".
- Default:
""
-