de.mguennewig.pobjects
Class Literal

java.lang.Object
  extended by de.mguennewig.pobjects.Literal
All Implemented Interfaces:
Term

public class Literal
extends java.lang.Object
implements Term

A literal value, for example a string, a number or an object.

Author:
Michael Günnewig

Constructor Summary
Literal(java.lang.Object value)
          Create a new literal.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tests whether this literal is equal to another object.
 java.lang.String getSqlValue(EvalContext eval)
          Returns the SQL representation for this term.
 java.lang.Object getValue()
          Returns the value of this literal.
 int hashCode()
          
 boolean isConstant()
          Tests whether the expression can be evaluated without an object.
 boolean isJoin()
          Tests whether this expression enforces any kind of join.
 boolean isSelection()
          Tests whether this expression is a selection.
static java.lang.String quoteString(java.lang.String s)
          Quotes the string by doubling any '.
 java.lang.String toString()
          Returns a textual representation for this literal.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Literal

public Literal(java.lang.Object value)
Create a new literal.

Method Detail

equals

public boolean equals(java.lang.Object obj)
Tests whether this literal is equal to another object.

Overrides:
equals in class java.lang.Object
Returns:
true if the other object is an existing literal with equal value.

getValue

public final java.lang.Object getValue()
Returns the value of this literal.


getSqlValue

public java.lang.String getSqlValue(EvalContext eval)
Returns the SQL representation for this term.

Specified by:
getSqlValue in interface Term
Parameters:
eval - An unused evaluation context.
See Also:
toString()

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

isConstant

public final boolean isConstant()
Description copied from interface: Term
Tests whether the expression can be evaluated without an object.

Specified by:
isConstant in interface Term

isJoin

public final boolean isJoin()
Description copied from interface: Term
Tests whether this expression enforces any kind of join.

Specified by:
isJoin in interface Term

isSelection

public final boolean isSelection()
Description copied from interface: Term
Tests whether this expression is a selection.

With selection is an expression meant that binds a Member to one Literal.

Specified by:
isSelection in interface Term

toString

public java.lang.String toString()
Returns a textual representation for this literal.

Overrides:
toString in class java.lang.Object
Returns:
The textual representation as used in SQL.
value SQL
null NULL
PObject instance The Id
Boolean Boolean.toString()
Number Object.toString()
anything else 'Object.toString()'

quoteString

public static java.lang.String quoteString(java.lang.String s)
Quotes the string by doubling any '.