org.enableit.db
Class DBFilter

java.lang.Object
  |
  +--org.enableit.db.DBFilter

public class DBFilter
extends java.lang.Object

Provides an encapsulated means to extend a SQL statement's WHERE clause.


Field Summary
static java.lang.String ABOUT
          CVS info about this class and its current version
static int EQ
          A valid match type
static int EXACT_MATCH
          Deprecated. Use EQ
static int GREATER_THAN_MATCH
          Deprecated. Use GT
static int GT
          A valid match type
static int GTEQ
          A valid match type
static int IS_NOT_NULL
          A valid match type
static int IS_NULL
          A valid match type
static int LESS_THAN_MATCH
          Deprecated. Use LT
static int LIKE
          A valid match type
static int LT
          A valid match type
static int LTEQ
          A valid match type
static int NE
          A valid match type
 
Constructor Summary
DBFilter()
          Default Constructor
DBFilter(java.lang.String name, java.lang.Object value)
          Convenience constructor.
DBFilter(java.lang.String name, java.lang.Object value, int match)
          Convenience constructor setting name, value and match as object is created.
DBFilter(java.lang.String name, java.lang.Object value, java.lang.String match)
          Convenience constructor.
DBFilter(java.lang.String name, java.lang.String value)
          Convenience constructor.
DBFilter(java.lang.String name, java.lang.String value, java.lang.Class type, int match)
          Convenience constructor setting name, value and match as object is created.
DBFilter(java.lang.String name, java.lang.String value, int match)
          Convenience constructor setting name, value and match as object is created.
DBFilter(java.lang.String name, java.lang.String value, java.lang.String type, int match)
          Convenience constructor setting name, value and match as object is created.
 
Method Summary
 java.lang.String getMatch()
           
 int getMatchType()
          Returns the type of match required as an int.
 java.lang.String getName()
           
static java.util.Map getOperators()
           
 java.lang.Object getValue()
           
 void setMatch(int match)
           
 void setName(java.lang.String name)
           
 void setValue(java.lang.Object value)
           
 void setValue(java.lang.String value)
           
 void setValue(java.lang.String value, java.lang.Class type)
           
 void setValue(java.lang.String value, java.lang.String type)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXACT_MATCH

public static final int EXACT_MATCH
Deprecated. Use EQ

A valid match type

See Also:
Constant Field Values

LESS_THAN_MATCH

public static final int LESS_THAN_MATCH
Deprecated. Use LT

A valid match type

See Also:
Constant Field Values

GREATER_THAN_MATCH

public static final int GREATER_THAN_MATCH
Deprecated. Use GT

A valid match type

See Also:
Constant Field Values

IS_NULL

public static final int IS_NULL
A valid match type

See Also:
Constant Field Values

IS_NOT_NULL

public static final int IS_NOT_NULL
A valid match type

See Also:
Constant Field Values

EQ

public static final int EQ
A valid match type

See Also:
Constant Field Values

LT

public static final int LT
A valid match type

See Also:
Constant Field Values

GT

public static final int GT
A valid match type

See Also:
Constant Field Values

LTEQ

public static final int LTEQ
A valid match type

See Also:
Constant Field Values

GTEQ

public static final int GTEQ
A valid match type

See Also:
Constant Field Values

NE

public static final int NE
A valid match type

See Also:
Constant Field Values

LIKE

public static final int LIKE
A valid match type

See Also:
Constant Field Values

ABOUT

public static final java.lang.String ABOUT
CVS info about this class and its current version

See Also:
Constant Field Values
Constructor Detail

DBFilter

public DBFilter()
Default Constructor


DBFilter

public DBFilter(java.lang.String name,
                java.lang.String value)
Convenience constructor.

Parameters:
name - Initialise filter name.
value - Initialise filter value.

DBFilter

public DBFilter(java.lang.String name,
                java.lang.Object value)
Convenience constructor.

Parameters:
name - Initialise filter name.
value - Initialise filter value.

DBFilter

public DBFilter(java.lang.String name,
                java.lang.String value,
                int match)
Convenience constructor setting name, value and match as object is created.

Parameters:
name - Initialise filter name.
value - Initialise filter value.
match - Initialise filter match (enumerated as class constants).

DBFilter

public DBFilter(java.lang.String name,
                java.lang.String value,
                java.lang.Class type,
                int match)
         throws org.apache.commons.beanutils.ConversionException
Convenience constructor setting name, value and match as object is created.

Parameters:
name - Initialise filter name.
value - Initialise filter value.
match - Initialise filter value type.

DBFilter

public DBFilter(java.lang.String name,
                java.lang.String value,
                java.lang.String type,
                int match)
         throws org.apache.commons.beanutils.ConversionException
Convenience constructor setting name, value and match as object is created.

Parameters:
name - Initialise filter name.
value - Initialise filter value.
type - Initialise filter value type (Java class name).
match - Initialise filter match (enumerated as class constants).

DBFilter

public DBFilter(java.lang.String name,
                java.lang.Object value,
                int match)
Convenience constructor setting name, value and match as object is created.

Parameters:
name - Initialise filter name.
value - Initialise filter value.
match - Initialise filter match (enumerated as class constants).

DBFilter

public DBFilter(java.lang.String name,
                java.lang.Object value,
                java.lang.String match)
Convenience constructor.

Parameters:
name - Initialise filter name.
value - Initialise filter value.
match - Initialise filter match with actual string (e.g. '=').
Method Detail

setName

public void setName(java.lang.String name)
Parameters:
name - The column to filter on.

setValue

public void setValue(java.lang.String value)

setValue

public void setValue(java.lang.Object value)

setValue

public void setValue(java.lang.String value,
                     java.lang.String type)
              throws org.apache.commons.beanutils.ConversionException
org.apache.commons.beanutils.ConversionException

setValue

public void setValue(java.lang.String value,
                     java.lang.Class type)
              throws org.apache.commons.beanutils.ConversionException
org.apache.commons.beanutils.ConversionException

setMatch

public void setMatch(int match)

getName

public java.lang.String getName()
Returns:
Name of the column to filter on

getValue

public java.lang.Object getValue()
Returns:
The value of column to filter on.

getMatchType

public int getMatchType()
Returns the type of match required as an int.

Returns:
matchType One of the matches enumerated in this class as constants.

getMatch

public java.lang.String getMatch()
Returns:
String representaion of the match.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String representation of the filter.

getOperators

public static java.util.Map getOperators()
Returns:
Map of the 'match' operators, keyed by a symbolic name.


Copyright © 1999-2004 enableIT.org. All Rights Reserved.