@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class PersistUtils extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T> PersistedObjects<T> |
getEntriesAsObjects(DN[] dns,
java.lang.Class<T> type,
LDAPInterface conn)
Retrieves and decodes the indicated entries as objects of the specified
type.
|
static <T> T |
getEntryAsObject(DN dn,
java.lang.Class<T> type,
LDAPInterface conn)
Retrieves the entry with the specified DN and decodes it as an object of
the specified type.
|
static boolean |
isValidJavaIdentifier(java.lang.String s,
java.lang.StringBuilder r)
Indicates whether the provided string could be used as a valid Java
identifier.
|
static boolean |
isValidLDAPName(java.lang.String s,
boolean o,
java.lang.StringBuilder r)
Indicates whether the provided string could be used as a valid attribute or
object class name.
|
static boolean |
isValidLDAPName(java.lang.String s,
java.lang.StringBuilder r)
Indicates whether the provided string could be used as a valid attribute or
object class name.
|
static java.lang.String |
toJavaIdentifier(java.lang.String s)
Transforms the provided string if necessary so that it may be used as a
valid Java identifier.
|
public static boolean isValidLDAPName(@NotNull java.lang.String s, @NotNull java.lang.StringBuilder r)
s
- The string for which to make the determination.r
- A buffer to which the unacceptable reason may be appended. It
must not be null
.true
if the provided string is acceptable for use as an
LDAP attribute or object class name, or false
if not.public static boolean isValidLDAPName(@NotNull java.lang.String s, boolean o, @NotNull java.lang.StringBuilder r)
s
- The string for which to make the determination.o
- Indicates whether the name should be allowed to contain
attribute options (e.g., a semicolon with one or more valid
characters after it).r
- A buffer to which the unacceptable reason may be appended. It
must not be null
.true
if the provided string is acceptable for use as an
LDAP attribute or object class name, or false
if not.public static boolean isValidJavaIdentifier(@NotNull java.lang.String s, @NotNull java.lang.StringBuilder r)
s
- The string for which to make the determination. It must not be
null
.r
- A buffer to which the unacceptable reason may be appended. It
must not be null
.true
if the provided string is acceptable for use as a
Java identifier, or false
if not.@NotNull public static java.lang.String toJavaIdentifier(@NotNull java.lang.String s)
s
- The attribute or object class name to be converted to a Java
identifier.@Nullable public static <T> T getEntryAsObject(@NotNull DN dn, @NotNull java.lang.Class<T> type, @NotNull LDAPInterface conn) throws LDAPException
T
- The type of object as which to decode the entry.dn
- The DN of the entry to retrieve. It must not be
null
.type
- The type of object as which the entry should be decoded. It
must not be null
, and the class must be marked with
the LDAPObject
annotation type.conn
- The connection that should be used to retrieve the entry. It
must not be null
.null
if
the entry cannot be retrieved (e.g., because it does not exist or
is not readable by the authenticated user).LDAPException
- If a problem occurs while trying to retrieve the
entry or decode it as the specified type of object.@NotNull public static <T> PersistedObjects<T> getEntriesAsObjects(@NotNull DN[] dns, @NotNull java.lang.Class<T> type, @NotNull LDAPInterface conn) throws LDAPPersistException
T
- The type of object as which to decode the entries.dns
- The DNs of the entries to retrieve. It must not be
null
.type
- The type of object as which the entries should be decoded.
It must not be null
, and the class must be marked
with the LDAPObject
annotation type.conn
- The connection that should be used to retrieve the entries.
It must not be null
.PersistedObjects
result that may be used to access the
objects decoded from the provided set of DNs.LDAPPersistException
- If the requested type cannot be used with
the LDAP SDK persistence framework.