com.sun.codemodel
Class JExpr

java.lang.Object
  extended by com.sun.codemodel.JExpr

public abstract class JExpr
extends java.lang.Object

Factory methods that generate various expressions.


Field Summary
static JExpression FALSE
          Boolean constant that represents false
static JExpression TRUE
          Boolean constant that represents true
 
Method Summary
static JInvocation _new(JClass c)
           
static JInvocation _new(JType t)
           
static JExpression _null()
           
static JExpression _super()
          Returns a reference to "super", an implicit reference to the super class.
static JExpression _this()
          Returns a reference to "this", an implicit reference to the current object.
static JExpression assign(JAssignmentTarget lhs, JExpression rhs)
           
static JExpression assignPlus(JAssignmentTarget lhs, JExpression rhs)
           
static JCast cast(JType type, JExpression expr)
           
static JArrayCompRef component(JExpression lhs, JExpression index)
           
static JExpression direct(java.lang.String source)
          Creates an expression directly from a source code fragment.
static JExpression dotclass(JClass cl)
           
static JExpression dotclass(JType t)
           
static JInvocation invoke(JExpression lhs, JMethod method)
           
static JInvocation invoke(JExpression lhs, java.lang.String method)
           
static JInvocation invoke(JMethod method)
           
static JInvocation invoke(java.lang.String method)
           
static JExpression lit(char c)
           
static JExpression lit(double d)
           
static JExpression lit(float f)
           
static JExpression lit(int n)
           
static JExpression lit(long n)
           
static JExpression lit(java.lang.String s)
           
static JArray newArray(JType type)
           
static JArray newArray(JType type, int size)
           
static JArray newArray(JType type, JExpression size)
           
static java.lang.String quotify(char quote, java.lang.String s)
          Escapes the given string, then surrounds it by the specified quotation mark.
static JFieldRef ref(JExpression lhs, JVar field)
           
static JFieldRef ref(JExpression lhs, java.lang.String field)
           
static JFieldRef ref(java.lang.String field)
           
static JFieldRef refthis(java.lang.String field)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final JExpression TRUE
Boolean constant that represents true


FALSE

public static final JExpression FALSE
Boolean constant that represents false

Method Detail

assign

public static JExpression assign(JAssignmentTarget lhs,
                                 JExpression rhs)

assignPlus

public static JExpression assignPlus(JAssignmentTarget lhs,
                                     JExpression rhs)

_new

public static JInvocation _new(JClass c)

_new

public static JInvocation _new(JType t)

invoke

public static JInvocation invoke(java.lang.String method)

invoke

public static JInvocation invoke(JMethod method)

invoke

public static JInvocation invoke(JExpression lhs,
                                 JMethod method)

invoke

public static JInvocation invoke(JExpression lhs,
                                 java.lang.String method)

ref

public static JFieldRef ref(java.lang.String field)

ref

public static JFieldRef ref(JExpression lhs,
                            JVar field)

ref

public static JFieldRef ref(JExpression lhs,
                            java.lang.String field)

refthis

public static JFieldRef refthis(java.lang.String field)

dotclass

public static JExpression dotclass(JClass cl)

dotclass

public static JExpression dotclass(JType t)

component

public static JArrayCompRef component(JExpression lhs,
                                      JExpression index)

cast

public static JCast cast(JType type,
                         JExpression expr)

newArray

public static JArray newArray(JType type)

newArray

public static JArray newArray(JType type,
                              JExpression size)

newArray

public static JArray newArray(JType type,
                              int size)

_this

public static JExpression _this()
Returns a reference to "this", an implicit reference to the current object.


_super

public static JExpression _super()
Returns a reference to "super", an implicit reference to the super class.


_null

public static JExpression _null()

lit

public static JExpression lit(int n)

lit

public static JExpression lit(long n)

lit

public static JExpression lit(float f)

lit

public static JExpression lit(double d)

quotify

public static java.lang.String quotify(char quote,
                                       java.lang.String s)
Escapes the given string, then surrounds it by the specified quotation mark.


lit

public static JExpression lit(char c)

lit

public static JExpression lit(java.lang.String s)

direct

public static JExpression direct(java.lang.String source)
Creates an expression directly from a source code fragment.

This method can be used as a short-cut to create a JExpression. For example, instead of _a.gt(_b), you can write it as: JExpr.direct("a>b").

Be warned that there is a danger in using this method, as it obfuscates the object model.