Android Open Source - TwelveRules Field






From Project

Back to project page TwelveRules.

License

The source code is released under:

Apache License

If you think the Android project TwelveRules listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.manuelpeinado.sql_dsl;
//ww w.java  2 s  .co  m
import static com.manuelpeinado.sql_dsl.Constants.AND;
import static com.manuelpeinado.sql_dsl.Constants.BETWEEN;
import static com.manuelpeinado.sql_dsl.Constants.COMMA;
import static com.manuelpeinado.sql_dsl.Constants.LEFT_PARENTHESIS;
import static com.manuelpeinado.sql_dsl.Constants.RIGHT_PARENTHESIS;
import static com.manuelpeinado.sql_dsl.Constants.SPACE;

public class Field extends DBObject<Field> {

    protected Field(String expression) {
        super(expression);
    }

    public static Field field(String expression) {
        return new Field(expression);
    }

    public Criterion eq(Object value) {
        return UnaryCriterion.eq(this, value);
    }

    public Criterion neq(Object value) {
        return UnaryCriterion.neq(this, value);
    }

    public Criterion gt(Object value) {
        return UnaryCriterion.gt(this, value);
    }

    public Criterion lt(final Object value) {
        return UnaryCriterion.lt(this, value);
    }

    public Criterion isNull() {
        return UnaryCriterion.isNull(this);
    }

    public Criterion isNotNull() {
        return UnaryCriterion.isNotNull(this);
    }

    public Criterion between(final Object lower, final Object upper) {
        final Field field = this;
        return new Criterion(null) {

            protected void populate(StringBuilder sb) {
                sb.append(field).append(SPACE).append(BETWEEN).append(SPACE).append(lower).append(SPACE).append(AND)
                        .append(SPACE).append(upper);
            }
        };
    }

    public Criterion like(final String value) {
        return UnaryCriterion.like(this, value);
    }

    public <T> Criterion in(final T... value) {
        final Field field = this;
        return new Criterion(Operator.in) {

            protected void populate(StringBuilder sb) {
                sb.append(field).append(SPACE).append(Operator.in).append(SPACE).append(LEFT_PARENTHESIS);
                for (T t : value) {
                    sb.append(t.toString()).append(COMMA);
                }
                sb.deleteCharAt(sb.length() - 1).append(RIGHT_PARENTHESIS);
            }
        };
    }

    public Criterion in(final Field expression, final Query query) {
        final Field field = this;
        return new Criterion(Operator.in) {

            protected void populate(StringBuilder sb) {
                sb.append(field).append(SPACE).append(Operator.in).append(SPACE).append(LEFT_PARENTHESIS).append(query)
                        .append(RIGHT_PARENTHESIS);
            }
        };
    }
}




Java Source Code List

com.manuelpeinado.sql_dsl.Constants.java
com.manuelpeinado.sql_dsl.Criterion.java
com.manuelpeinado.sql_dsl.DBObject.java
com.manuelpeinado.sql_dsl.Field.java
com.manuelpeinado.sql_dsl.GroupBy.java
com.manuelpeinado.sql_dsl.JoinType.java
com.manuelpeinado.sql_dsl.Join.java
com.manuelpeinado.sql_dsl.Operator.java
com.manuelpeinado.sql_dsl.OrderType.java
com.manuelpeinado.sql_dsl.Order.java
com.manuelpeinado.sql_dsl.Query.java
com.manuelpeinado.sql_dsl.Table.java
com.manuelpeinado.sql_dsl.UnaryCriterion.java
com.manuelpeinado.twelverules.AssetsDatabase.java
com.manuelpeinado.twelverules.ColumnSet.java
com.manuelpeinado.twelverules.ContentValuesCreator.java
com.manuelpeinado.twelverules.DatabaseColumn.java
com.manuelpeinado.twelverules.DatabaseTable.java
com.manuelpeinado.twelverules.Database.java
com.manuelpeinado.twelverules.DbUtils.java
com.manuelpeinado.twelverules.IDatabase.java