Utility classes for dynamically building LDAP filters. Filters can be nested and wrapped around each other:

    AndFilter andFilter = new AndFilter();
    andFilter.and(new EqualsFilter("objectclass", "person");
    andFilter.and(new EqualsFilter("cn", "Some CN");
    OrFilter orFilter = new OrFilter();
    orFilter.or(andFilter);
    orFilter.or(new EqualsFilter("objectclass", "organizationalUnit));
    System.out.println(orFilter.encode());

would result in:

    (|(&(objectclass=person)(cn=Some CN))(objectclass=organizationalUnit))