org.acmsl.queryj
Class ConditionFactory

java.lang.Object
  |
  +--org.acmsl.queryj.ConditionFactory

public class ConditionFactory
extends java.lang.Object

Has the responsiblity of knowing how to create conditions.

Version:
$Revision: 1.1 $
Author:
Jose San Leandro

Nested Class Summary
protected static class ConditionFactory._AtomicConditionWrapper
          Envelopes a condition surrounding it with appropiate prefix and suffix.
protected static class ConditionFactory._ConditionWrapper
          Envelopes a condition surrounding it with appropiate prefix and suffix.
protected static class ConditionFactory._VariableConditionWrapper
          Envelopes a variable condition surrounding it with appropiate prefix and suffix.
 
Constructor Summary
protected ConditionFactory()
          Protected constructor to avoid accidental instantiation.
 
Method Summary
 Condition createCondition(Field leftSideField, ConditionOperator operator, Field rightSideField)
          Creates a condition
 Condition createCondition(Field leftSideField, ConditionOperator operator, int value)
          Creates a condition
 VariableCondition createVariableCondition(Field field, ConditionOperator operator)
          Creates a variable condition.
static ConditionFactory getInstance()
          Retrieves a ConditionFactory instance.
protected static java.lang.ref.WeakReference getReference()
          Retrieves the weak reference.
protected static void setReference(ConditionFactory factory)
          Specifies a new weak reference.
 Condition wrap(AtomicCondition condition, java.lang.String prefix, java.lang.String suffix)
          Creates a wrapper condition.
 Condition wrap(Condition condition, java.lang.String prefix, java.lang.String suffix)
          Creates a wrapper condition.
 VariableCondition wrap(VariableCondition condition, java.lang.String prefix, java.lang.String suffix)
          Creates a wrapper condition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConditionFactory

protected ConditionFactory()
Protected constructor to avoid accidental instantiation.

Method Detail

setReference

protected static void setReference(ConditionFactory factory)
Specifies a new weak reference.

Parameters:
factory - the factory instance to use.

getReference

protected static java.lang.ref.WeakReference getReference()
Retrieves the weak reference.

Returns:
such reference.

getInstance

public static ConditionFactory getInstance()
Retrieves a ConditionFactory instance.

Returns:
such instance.

createCondition

public Condition createCondition(Field leftSideField,
                                 ConditionOperator operator,
                                 Field rightSideField)
Creates a condition

Parameters:
leftSideField - the left-side field.
operator - the operator.
rightSideField - the right-side field.
Returns:
such type of instance.

createCondition

public Condition createCondition(Field leftSideField,
                                 ConditionOperator operator,
                                 int value)
Creates a condition

Parameters:
leftSideField - the left-side field.
operator - the operator.
value - the fixed value.
Returns:
such type of instance.

createVariableCondition

public VariableCondition createVariableCondition(Field field,
                                                 ConditionOperator operator)
Creates a variable condition.

Parameters:
field - the field.
operator - the operator.
Returns:
such type of instance.

wrap

public Condition wrap(Condition condition,
                      java.lang.String prefix,
                      java.lang.String suffix)
Creates a wrapper condition.

Parameters:
condition - the condition to wrap.
prefix - the prefix.
suffix - the suffix.
Returns:
the wrapped condition.

wrap

public Condition wrap(AtomicCondition condition,
                      java.lang.String prefix,
                      java.lang.String suffix)
Creates a wrapper condition.

Parameters:
condition - the condition to wrap.
prefix - the prefix.
suffix - the suffix.
Returns:
the wrapped condition.

wrap

public VariableCondition wrap(VariableCondition condition,
                              java.lang.String prefix,
                              java.lang.String suffix)
Creates a wrapper condition.

Parameters:
condition - the condition to wrap.
prefix - the prefix.
suffix - the suffix.
Returns:
the wrapped condition.


Copyright © 2003 ACM S.L.. All Rights Reserved.