org.apache.ojb.broker.query
Class SelectionCriteria

java.lang.Object
  extended byorg.apache.ojb.broker.query.SelectionCriteria
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ExistsCriteria, FieldCriteria, SqlCriteria, ValueCriteria

public abstract class SelectionCriteria
extends java.lang.Object
implements java.io.Serializable

abstract baseclass of all criteria classes, can't be instantiated. This code is based on stuff from COBRA - Java Object Persistence Layer Copyright (C) 1997, 1998 DB Harvey-George eMail: cobra@lowrent.org

Version:
$Id: SelectionCriteria.java,v 1.13 2004/01/07 11:41:20 thma Exp $
Author:
DB Harvey-George, Thomas Mahler, Jakob Braeuchi
See Also:
Serialized Form

Field Summary
protected static java.lang.String BETWEEN
           
protected static java.lang.String EQUAL
           
protected static java.lang.String GREATER
           
protected static java.lang.String IN
           
protected static java.lang.String IS_NULL
           
protected static java.lang.String LESS
           
protected static java.lang.String LIKE
           
protected static java.lang.String NOT_BETWEEN
           
protected static java.lang.String NOT_EQUAL
           
protected static java.lang.String NOT_GREATER
           
protected static java.lang.String NOT_IN
           
protected static java.lang.String NOT_IS_NULL
           
protected static java.lang.String NOT_LESS
           
protected static java.lang.String NOT_LIKE
           
(package private) static long serialVersionUID
           
 
Constructor Summary
(package private) SelectionCriteria(java.lang.Object anAttribute, java.lang.Object aValue, java.lang.String alias)
          Constructor declaration
 
Method Summary
 void bind(java.lang.Object newValue)
          sets the value of the criteria to newValue.
 java.lang.String getAlias()
           
 java.lang.Object getAttribute()
          Answer the attribute
abstract  java.lang.String getClause()
          Answer the SQL compare-clause for this criteria
 Criteria getCriteria()
           
 int getNumberOfExtentsToBind()
          Returns the numberOfExtentsToBind.
 QueryByCriteria getQuery()
           
 java.lang.Object getValue()
          Answer the value
protected  boolean isBindable()
          answer true if the selection criteria is bindable BRJ: value null is bindable
 boolean isBound()
          BRJ : Used by the ODMG OQLQuery.bind() operation
 boolean isTranslateAttribute()
           
 void setAlias(java.lang.String alias)
          Sets the alias.
protected  void setBound(boolean bound)
          Sets the bound.
(package private)  void setCriteria(Criteria criteria)
           
 void setNumberOfExtentsToBind(int numberOfExtentsToBind)
          Sets the numberOfExtentsToBind.
(package private)  void setTranslateAttribute(boolean b)
           
protected  void setValue(java.lang.Object value)
          Sets the value.
 java.lang.String toString()
          String representation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EQUAL

protected static final java.lang.String EQUAL
See Also:
Constant Field Values

NOT_EQUAL

protected static final java.lang.String NOT_EQUAL
See Also:
Constant Field Values

GREATER

protected static final java.lang.String GREATER
See Also:
Constant Field Values

NOT_GREATER

protected static final java.lang.String NOT_GREATER
See Also:
Constant Field Values

LESS

protected static final java.lang.String LESS
See Also:
Constant Field Values

NOT_LESS

protected static final java.lang.String NOT_LESS
See Also:
Constant Field Values

LIKE

protected static final java.lang.String LIKE
See Also:
Constant Field Values

NOT_LIKE

protected static final java.lang.String NOT_LIKE
See Also:
Constant Field Values

IS_NULL

protected static final java.lang.String IS_NULL
See Also:
Constant Field Values

NOT_IS_NULL

protected static final java.lang.String NOT_IS_NULL
See Also:
Constant Field Values

BETWEEN

protected static final java.lang.String BETWEEN
See Also:
Constant Field Values

NOT_BETWEEN

protected static final java.lang.String NOT_BETWEEN
See Also:
Constant Field Values

IN

protected static final java.lang.String IN
See Also:
Constant Field Values

NOT_IN

protected static final java.lang.String NOT_IN
See Also:
Constant Field Values
Constructor Detail

SelectionCriteria

SelectionCriteria(java.lang.Object anAttribute,
                  java.lang.Object aValue,
                  java.lang.String alias)
Constructor declaration

Parameters:
anAttribute - column- or fieldName or a Query
aValue - the value to compare with
alias - use alias to link anAttribute to
Method Detail

getClause

public abstract java.lang.String getClause()
Answer the SQL compare-clause for this criteria


bind

public void bind(java.lang.Object newValue)
sets the value of the criteria to newValue. Used by the ODMG OQLQuery.bind() operation


getValue

public java.lang.Object getValue()
Answer the value


getAttribute

public java.lang.Object getAttribute()
Answer the attribute


toString

public java.lang.String toString()
String representation


isBound

public boolean isBound()
BRJ : Used by the ODMG OQLQuery.bind() operation

Returns:
Returns a boolean indicator

setBound

protected void setBound(boolean bound)
Sets the bound.

Parameters:
bound - The bound to set

setValue

protected void setValue(java.lang.Object value)
Sets the value.

Parameters:
value - The value to set

isBindable

protected boolean isBindable()
answer true if the selection criteria is bindable BRJ: value null is bindable


getNumberOfExtentsToBind

public int getNumberOfExtentsToBind()
Returns the numberOfExtentsToBind.

Returns:
int

setNumberOfExtentsToBind

public void setNumberOfExtentsToBind(int numberOfExtentsToBind)
Sets the numberOfExtentsToBind.

Parameters:
numberOfExtentsToBind - The numberOfExtentsToBind to set

getAlias

public java.lang.String getAlias()
Returns:
String

setAlias

public void setAlias(java.lang.String alias)
Sets the alias.

Parameters:
alias - The alias to set

isTranslateAttribute

public boolean isTranslateAttribute()
Returns:
true if attribute name should be translated into column name

setTranslateAttribute

void setTranslateAttribute(boolean b)
Parameters:
b -

getCriteria

public Criteria getCriteria()
Returns:

setCriteria

void setCriteria(Criteria criteria)
Parameters:
criteria -

getQuery

public QueryByCriteria getQuery()


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14