Package com.unboundid.ldap.sdk.persist
Annotation Type LDAPSetter
-
@Documented @Retention(RUNTIME) @Target(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 theLDAPObjectannotation 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 (includingpublic,protected,private, or no access modifier at all indicating package-level access). The associated attribute must not be referenced by any otherLDAPFieldorLDAPSetterannotations in the same class, and it may be referenced by at most oneLDAPGetterannotation.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringattributeThe name of the attribute type in which the value of the associated method will be stored.java.lang.Class<? extends ObjectEncoder>encoderClassThe class that provides the logic for encoding the value of this method to an LDAP attribute.booleanfailOnInvalidValueIndicates 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.booleanfailOnTooManyValuesIndicates 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 Detail
-
failOnInvalidValue
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 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 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 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
@NotNull java.lang.Class<? extends ObjectEncoder> 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
@NotNull 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.- 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:
- ""
-
-