org.jpox.store.expression
Class IntegerLiteral

java.lang.Object
  extended byorg.jpox.store.expression.ScalarExpression
      extended byorg.jpox.store.expression.NumericExpression
          extended byorg.jpox.store.expression.IntegerLiteral
All Implemented Interfaces:
Literal

public class IntegerLiteral
extends NumericExpression
implements Literal

Representation of an Integer literal.

Version:
$Revision: 1.15 $

Nested Class Summary
 
Nested classes inherited from class org.jpox.store.expression.ScalarExpression
ScalarExpression.DyadicOperator, ScalarExpression.ExpressionList, ScalarExpression.FieldExpression, ScalarExpression.IllegalArgumentTypeException, ScalarExpression.IllegalOperationException, ScalarExpression.MethodInvocationException, ScalarExpression.MonadicOperator, ScalarExpression.Operator
 
Field Summary
 
Fields inherited from class org.jpox.store.expression.ScalarExpression
aliasIdentifier, expressionList, FILTER, LOCALISER, lowestOperator, mapping, OP_ADD, OP_AND, OP_BETWEEN, OP_COM, OP_CONCAT, OP_DIV, OP_EQ, OP_GT, OP_GTEQ, OP_IN, OP_IS, OP_ISNOT, OP_LIKE, OP_LT, OP_LTEQ, OP_MOD, OP_MUL, OP_NEG, OP_NOT, OP_NOTEQ, OP_OR, OP_SUB, PROJECTION, qs, st, te
 
Constructor Summary
IntegerLiteral(QueryExpression qs, JavaTypeMapping mapping, java.lang.Number value)
          Creates a integer literal
IntegerLiteral(QueryExpression qs, JavaTypeMapping mapping, java.lang.Number value, boolean useParameter)
          Creates a integer literal.
 
Method Summary
 ScalarExpression add(ScalarExpression expr)
          If both operands are instances of IntegerLiteral, the operation results in BigInteger type.
 ScalarExpression div(ScalarExpression expr)
          If both operands are instances of IntegerLiteral, the operation results in BigInteger type.
 BooleanExpression eq(ScalarExpression expr)
          Equality operator (equals to)
 java.lang.Object getValue()
          Accessor to the literal value
 BooleanExpression gt(ScalarExpression expr)
          Relational operator (greater than)
 BooleanExpression gteq(ScalarExpression expr)
          Relational operator (greater than or equals)
 BooleanExpression lt(ScalarExpression expr)
          Relational operator (lower than)
 BooleanExpression lteq(ScalarExpression expr)
          Relational operator (lower than or equals)
 ScalarExpression mod(ScalarExpression expr)
          If both operands are instances of IntegerLiteral, the operation results in BigInteger type.
 ScalarExpression mul(ScalarExpression expr)
          If both operands are instances of IntegerLiteral, the operation results in BigInteger type.
 ScalarExpression neg()
          Operation results in BigInteger type.
 BooleanExpression noteq(ScalarExpression expr)
          Equality operator (not equals to)
 ScalarExpression sub(ScalarExpression expr)
          If both operands are instances of IntegerLiteral, the operation results in BigInteger type.
 StatementText toStatementText(int mode)
          StatementText representation of this expression.
 
Methods inherited from class org.jpox.store.expression.NumericExpression
com, in
 
Methods inherited from class org.jpox.store.expression.ScalarExpression
accessField, and, as, callMethod, cast, encloseWithInParentheses, eor, equals, getAlias, getExpressionList, getLogicSetExpression, getMapping, getNonAliasExpression, getQueryExpression, instanceOf, ior, not, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerLiteral

public IntegerLiteral(QueryExpression qs,
                      JavaTypeMapping mapping,
                      java.lang.Number value)
Creates a integer literal

Parameters:
qs - the QueryExpression
mapping - the mapping
value - the integer value

IntegerLiteral

public IntegerLiteral(QueryExpression qs,
                      JavaTypeMapping mapping,
                      java.lang.Number value,
                      boolean useParameter)
Creates a integer literal. This constructor should only be used when the value will not change if the Query is run several times.

Parameters:
qs - the QueryExpression
mapping - the mapping
value - the integer value
useParameter - whether to use parameter or a literal in the expression when preparing the statement
Method Detail

getValue

public java.lang.Object getValue()
Description copied from interface: Literal
Accessor to the literal value

Specified by:
getValue in interface Literal
Returns:
the value of the literal

eq

public BooleanExpression eq(ScalarExpression expr)
Description copied from class: ScalarExpression
Equality operator (equals to)

Overrides:
eq in class NumericExpression

noteq

public BooleanExpression noteq(ScalarExpression expr)
Description copied from class: ScalarExpression
Equality operator (not equals to)

Overrides:
noteq in class NumericExpression

lt

public BooleanExpression lt(ScalarExpression expr)
Description copied from class: ScalarExpression
Relational operator (lower than)

Overrides:
lt in class NumericExpression

lteq

public BooleanExpression lteq(ScalarExpression expr)
Description copied from class: ScalarExpression
Relational operator (lower than or equals)

Overrides:
lteq in class NumericExpression

gt

public BooleanExpression gt(ScalarExpression expr)
Description copied from class: ScalarExpression
Relational operator (greater than)

Overrides:
gt in class NumericExpression

gteq

public BooleanExpression gteq(ScalarExpression expr)
Description copied from class: ScalarExpression
Relational operator (greater than or equals)

Overrides:
gteq in class NumericExpression

add

public ScalarExpression add(ScalarExpression expr)
If both operands are instances of IntegerLiteral, the operation results in BigInteger type. TODO fix this to follow JVM type conversions

Overrides:
add in class NumericExpression

sub

public ScalarExpression sub(ScalarExpression expr)
If both operands are instances of IntegerLiteral, the operation results in BigInteger type. TODO fix this to follow JVM type conversions

Overrides:
sub in class NumericExpression

mul

public ScalarExpression mul(ScalarExpression expr)
If both operands are instances of IntegerLiteral, the operation results in BigInteger type. TODO fix this to follow JVM type conversions

Overrides:
mul in class NumericExpression

div

public ScalarExpression div(ScalarExpression expr)
If both operands are instances of IntegerLiteral, the operation results in BigInteger type. TODO fix this to follow JVM type conversions

Overrides:
div in class NumericExpression

mod

public ScalarExpression mod(ScalarExpression expr)
If both operands are instances of IntegerLiteral, the operation results in BigInteger type. TODO fix this to follow JVM type conversions

Overrides:
mod in class NumericExpression
Parameters:
expr - The expression to modulus against
Returns:
The modulus expression

neg

public ScalarExpression neg()
Operation results in BigInteger type. TODO fix this to follow JVM type conversions

Overrides:
neg in class NumericExpression

toStatementText

public StatementText toStatementText(int mode)
Description copied from class: ScalarExpression
StatementText representation of this expression. I.E. A Boolean field may be stored in boolean format like 0 or 1, and it can also be stored in other formats, like Y or N, TRUE or FALSE, and so on. The projection mode for the boolean field is the real content of the value stored, (e.g. Y or N), and opposed to that the filter mode for the boolean field is always represented by a boolean expression (e.g. Y=Y or N=N) In SQL, the projection can be exemplified as "SELECT BOOLEAN_FIELD ... " and the filter as "SELECT COLUMNS ... WHERE BOOLEAN_FIELD ='Y'"

Overrides:
toStatementText in class ScalarExpression
Parameters:
mode - (0=PROJECTION;1=FILTER)
Returns:
the StatementText


Copyright © -2007 . All Rights Reserved.