Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package org.litesoft.orsup.base;

import org.litesoft.db.*;
import org.litesoft.orsup.selection.*;

public abstract class POFilteringWhereClause
{
    abstract public boolean selects( PersistentObject pPO )
            throws DBException;

    public WhereClauseType getType()
    {
        return mType;
    }

    private WhereClauseType mType;

    protected POFilteringWhereClause( WhereClauseType pType )
    {
        mType = pType;
    }

    /**
     * Generate a Debug friendly representation.<p>
     *
     * @return a String for Debuging.
     */
    public final String toString()
    {
        StringBuilder sb = new StringBuilder( "Filter " );
        appendPO( sb );
        sb.append( "Where " );
        toStringHelper( sb );
        return sb.toString();
    }

    /**
     * Helper method for <b>toString()</b> that provides a more efficient
     * mechanism for the recursive decent of a WhereClause <i>tree</i>.<p>
     *
     * @param pSB the StringBuilder to build the WhereClause into.<p>
     *
     * @see #toString()
     */
    protected abstract void appendPO( StringBuilder pSB );

    /**
     * Helper method for <b>toString()</b> that provides a more efficient
     * mechanism for the recursive decent of a WhereClause <i>tree</i>.<p>
     *
     * @param pSB the StringBuilder to build the WhereClause into.<p>
     *
     * @see #toString()
     */
    protected abstract void toStringHelper( StringBuilder pSB );

    /**
     * Helper method for <b>toStringHelper()</b> that adds a parenthesized
     * nested WhereClause.<p>
     *
     * @param pSB     the StringBuilder to build the WhereClause into.
     * @param pFilter the nested WhereClause to wrap with parenthesizes
     *                and append.<p>
     *
     * @see #toStringHelper(StringBuilder)
     */
    protected static void toStringHelperParenthesizer( StringBuilder pSB, POFilteringWhereClause pFilter )
    {
        pSB.append( '(' );
        pFilter.toStringHelper( pSB );
        pSB.append( ')' );
    }

    /**
     * Helper method for <b>toStringHelper()</b> that adds a prefix and then
     * parenthesizes a nested WhereClause.<p>
     *
     * @param pSB     the StringBuilder to build the WhereClause into.
     * @param pPreFix the prefix to append.
     * @param pFilter the nested WhereClause to wrap with parenthesizes
     *                and append.<p>
     *
     * @see #toStringHelper(StringBuilder)
     */
    protected static void toStringHelperParenthesizer( StringBuilder pSB, String pPreFix,
                                                       POFilteringWhereClause pFilter )
    {
        pSB.append( pPreFix );
        pSB.append( ' ' );
        toStringHelperParenthesizer( pSB, pFilter );
    }
}

Commits for litesoft/trunk/Java/core/Server/src/org/litesoft/orsup/base/POFilteringWhereClause.java

Diff revisions: vs.
Revision Author Commited Message
2 GeorgeS picture GeorgeS Sun 07 Feb, 2010 12:50:58 +0000