public final class LdapFilter extends Object
The problem this class solves is the following.
When an attribute, for instance Name
, is mapped to an entry's DN,
and the user constructs an EqualsFilter
for that attribute, the connector
needs to translate that Filter
into a native LDAP filter. The connector
could use the entryDN
attribute in the native filter, but some servers might
not support that attribute. Instead, such a Filter
is translated
to an LdapFilter
with that entry DN. A composed filter, for instance:
Name name = new Name("uid=foo,dc=example,dc=com"); Attribute attr = AttributeBuilder.build("foo", "bar"); FilterBuilder.and( FilterBuilder.equalTo(name), FilterBuilder.equalTo(attr));
can be translated to a single LdapFilter
whose entry DN corresponds
to aName
and whose filter string is (foo=bar)
.
Modifier and Type | Method and Description |
---|---|
LdapFilter |
and(LdapFilter other)
Logically "ANDs" together this filter with another filter.
|
boolean |
equals(Object o) |
static LdapFilter |
forEntryDN(String entryDN) |
static LdapFilter |
forNativeFilter(String nativeFilter) |
String |
getEntryDN() |
String |
getNativeFilter() |
int |
hashCode() |
LdapFilter |
or(LdapFilter other)
Logically "ORs" together this filter with another filter.
|
String |
toString() |
LdapFilter |
withNativeFilter(String nativeFilter) |
public static LdapFilter forEntryDN(String entryDN)
public static LdapFilter forNativeFilter(String nativeFilter)
public LdapFilter withNativeFilter(String nativeFilter)
public String getNativeFilter()
public String getEntryDN()
public LdapFilter and(LdapFilter other)
If at most one of the two filters has an entry DN, the
result is a filter with that entry DN (if any) and a native filter
whose value is the native filters of the two filters "ANDed"
together using the LDAP &
operator.
Otherwise, the method returns null
.
other
- the other filter.null
.public LdapFilter or(LdapFilter other)
If none of the two filters has an entry DN, the
result is a filter with no entry DN and a native filter
whose value is the native filters of the two filters "ORed"
together using the LDAP |
filter operator.
Otherwise, the method returns null
.
other
- the other filter.null
.Copyright © 2018–2025. All rights reserved.