org.apache.ojb.broker.query
Class LikeCriteria

java.lang.Object
  extended byorg.apache.ojb.broker.query.SelectionCriteria
      extended byorg.apache.ojb.broker.query.ValueCriteria
          extended byorg.apache.ojb.broker.query.LikeCriteria
All Implemented Interfaces:
java.io.Serializable

public class LikeCriteria
extends ValueCriteria

Model a Like Criteria
Escape Processing by Paul R. Nase

The pattern string is a simple pattern string using % or * as a wildcard. So Ander* would match Anderson and Anderton. The _ or ? character is used to match a single occurence of a character. The '\' is used to escape the wildcard characters so that we can search for strings containing * and ?.

To change the escape character use setEscapeCharacter.

Version:
$Id: LikeCriteria.java,v 1.11.2.1 2004/07/26 15:49:52 brj Exp $
Author:
Jakob Braeuchi , Paul Nase
See Also:
setEscapeCharacter(char), Serialized Form

Field Summary
static char DEFAULT_ESCPAPE_CHARACTER
          The Dfault-Character used for Escaping Wildcards
 
Constructor Summary
LikeCriteria(java.lang.Object anAttribute, java.lang.Object aValue, java.lang.String aClause, java.lang.String anAlias)
           
LikeCriteria(java.lang.Object anAttribute, java.lang.Object aValue, java.lang.String aClause, UserAlias anAlias)
           
 
Method Summary
 void bind(java.lang.Object newValue)
          sets the value of the criteria to newValue.
static char getEscapeCharacter()
           
static void setEscapeCharacter(char escChar)
          Global change of the escapeCharacter
 
Methods inherited from class org.apache.ojb.broker.query.ValueCriteria
getClause
 
Methods inherited from class org.apache.ojb.broker.query.SelectionCriteria
getAlias, getAttribute, getClassesForPath, getCriteria, getNumberOfExtentsToBind, getPathClasses, getQuery, getUserAlias, getValue, isBound, isTranslateAttribute, setAlias, setAlias, setAlias, setNumberOfExtentsToBind, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_ESCPAPE_CHARACTER

public static final char DEFAULT_ESCPAPE_CHARACTER
The Dfault-Character used for Escaping Wildcards

See Also:
Constant Field Values
Constructor Detail

LikeCriteria

public LikeCriteria(java.lang.Object anAttribute,
                    java.lang.Object aValue,
                    java.lang.String aClause,
                    java.lang.String anAlias)
Parameters:
anAttribute -
aValue -
aClause -
anAlias -

LikeCriteria

public LikeCriteria(java.lang.Object anAttribute,
                    java.lang.Object aValue,
                    java.lang.String aClause,
                    UserAlias anAlias)
Parameters:
anAttribute -
aValue -
aClause -
anAlias -
Method Detail

bind

public void bind(java.lang.Object newValue)
Description copied from class: SelectionCriteria
sets the value of the criteria to newValue. Used by the ODMG OQLQuery.bind() operation

Overrides:
bind in class SelectionCriteria
See Also:
SelectionCriteria.bind(java.lang.Object)

getEscapeCharacter

public static char getEscapeCharacter()
Returns:
Returns the escapeCharacter.

setEscapeCharacter

public static void setEscapeCharacter(char escChar)
Global change of the escapeCharacter

Parameters:
escChar - The escapeCharacter to set.


(C) 2002 - 2004 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.3, 2005-04-2