toolbox.ldap
Class LDAPFilter

Package class diagram package LDAPFilter
java.lang.Object
  extended by toolbox.ldap.LDAPFilter

public class LDAPFilter
extends java.lang.Object

Utility class to generate LDAP filters in more or less the same way as prepared statements.

The class will make it possible to specificy LDAP filters as follows:

     (&((objectclass=?)(uid=?)))
 
Set the filter parameters using the setParameter method and obtain the end result using the getFilterString method.


Constructor Summary
LDAPFilter(java.lang.String filterTemplate)
          Construct a new filter with the given filter template.
 
Method Summary
 java.lang.String getFilterString()
          Return the fitler based on the template and parameters.
static java.lang.String getFilterString(java.lang.String filterTemplate, java.lang.String[] params)
          Convenience method to do everything in one go.
 void setParameter(int index, java.lang.String value)
          Set the value of the parameter at the given position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPFilter

public LDAPFilter(java.lang.String filterTemplate)
Construct a new filter with the given filter template.

Parameters:
filterTemplate - String containing the filter template.
Method Detail

setParameter

public void setParameter(int index,
                         java.lang.String value)
Set the value of the parameter at the given position.

Parameters:
index - int indicating the index of the parameter.
value - String containing the value of the parameter.

getFilterString

public java.lang.String getFilterString()
Return the fitler based on the template and parameters.

Returns:
String containing the populuated filter.

getFilterString

public static java.lang.String getFilterString(java.lang.String filterTemplate,
                                               java.lang.String[] params)
Convenience method to do everything in one go.

Parameters:
filterTemplate - String containing filter template.
params - String array containing parameter values.
Returns:
String containing the filter.