org.mule.devkit.model.code
Class ExpressionFactory

java.lang.Object
  extended by org.mule.devkit.model.code.ExpressionFactory

public abstract class ExpressionFactory
extends Object

Factory methods that generate various GeneratedExpressions.


Field Summary
static GeneratedExpression FALSE
          Boolean constant that represents false
static GeneratedExpression TRUE
          Boolean constant that represents true
 
Method Summary
static GeneratedInvocation _new(Type t)
           
static GeneratedInvocation _new(TypeReference c)
           
static GeneratedExpression _null()
           
static GeneratedExpression _super()
          Returns a reference to "super", an implicit reference to the super class.
static GeneratedExpression _this()
          Returns a reference to "this", an implicit reference to the current object.
static GeneratedExpression assign(AssignmentTarget lhs, GeneratedExpression rhs)
           
static GeneratedExpression assignPlus(AssignmentTarget lhs, GeneratedExpression rhs)
           
static GeneratedCast cast(Type type, GeneratedExpression expr)
           
static org.mule.devkit.model.code.ArrayCompRef component(GeneratedExpression lhs, GeneratedExpression index)
           
static GeneratedExpression direct(String source)
          Creates an expression directly from a source code fragment.
static GeneratedExpression dotclass(Type cl)
           
static GeneratedInvocation invoke(GeneratedExpression lhs, GeneratedMethod method)
           
static GeneratedInvocation invoke(GeneratedExpression lhs, String method)
           
static GeneratedInvocation invoke(GeneratedMethod method)
           
static GeneratedInvocation invoke(String method)
           
static GeneratedExpression lit(boolean b)
           
static GeneratedExpression lit(char c)
           
static GeneratedExpression lit(double d)
           
static GeneratedExpression lit(float f)
           
static GeneratedExpression lit(int n)
           
static GeneratedExpression lit(long n)
           
static GeneratedExpression lit(String s)
           
static GeneratedArray newArray(Type type)
           
static GeneratedArray newArray(Type type, GeneratedExpression size)
          Generates new T[size].
static GeneratedArray newArray(Type type, int size)
          Generates new T[size].
static String quotify(char quote, String s)
          Escapes the given string, then surrounds it by the specified quotation mark.
static GeneratedFieldReference ref(GeneratedExpression lhs, GeneratedVariable field)
           
static GeneratedFieldReference ref(GeneratedExpression lhs, String field)
           
static GeneratedFieldReference ref(String field)
           
static GeneratedFieldReference refthis(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 GeneratedExpression TRUE
Boolean constant that represents true


FALSE

public static final GeneratedExpression FALSE
Boolean constant that represents false

Method Detail

assign

public static GeneratedExpression assign(AssignmentTarget lhs,
                                         GeneratedExpression rhs)

assignPlus

public static GeneratedExpression assignPlus(AssignmentTarget lhs,
                                             GeneratedExpression rhs)

_new

public static GeneratedInvocation _new(TypeReference c)

_new

public static GeneratedInvocation _new(Type t)

invoke

public static GeneratedInvocation invoke(String method)

invoke

public static GeneratedInvocation invoke(GeneratedMethod method)

invoke

public static GeneratedInvocation invoke(GeneratedExpression lhs,
                                         GeneratedMethod method)

invoke

public static GeneratedInvocation invoke(GeneratedExpression lhs,
                                         String method)

ref

public static GeneratedFieldReference ref(String field)

ref

public static GeneratedFieldReference ref(GeneratedExpression lhs,
                                          GeneratedVariable field)

ref

public static GeneratedFieldReference ref(GeneratedExpression lhs,
                                          String field)

refthis

public static GeneratedFieldReference refthis(String field)

dotclass

public static GeneratedExpression dotclass(Type cl)

component

public static org.mule.devkit.model.code.ArrayCompRef component(GeneratedExpression lhs,
                                                                GeneratedExpression index)

cast

public static GeneratedCast cast(Type type,
                                 GeneratedExpression expr)

newArray

public static GeneratedArray newArray(Type type)

newArray

public static GeneratedArray newArray(Type type,
                                      GeneratedExpression size)
Generates new T[size].

Parameters:
type - The type of the array component. 'T' or new T[size].

newArray

public static GeneratedArray newArray(Type type,
                                      int size)
Generates new T[size].

Parameters:
type - The type of the array component. 'T' or new T[size].

_this

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


_super

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


_null

public static GeneratedExpression _null()

lit

public static GeneratedExpression lit(boolean b)

lit

public static GeneratedExpression lit(int n)

lit

public static GeneratedExpression lit(long n)

lit

public static GeneratedExpression lit(float f)

lit

public static GeneratedExpression lit(double d)

quotify

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


lit

public static GeneratedExpression lit(char c)

lit

public static GeneratedExpression lit(String s)

direct

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

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

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



Copyright © 2010-2013 MuleSoft, Inc.. All Rights Reserved.