com.google.clearsilver.jsilver.compiler
Enum JavaExpression.Type

java.lang.Object
  extended by java.lang.Enum<JavaExpression.Type>
      extended by com.google.clearsilver.jsilver.compiler.JavaExpression.Type
All Implemented Interfaces:
Serializable, Comparable<JavaExpression.Type>
Enclosing class:
JavaExpression

public static enum JavaExpression.Type
extends Enum<JavaExpression.Type>

Simple type enumeration to allow us to compare the return types of expressions easily and cast expressions nicely.


Enum Constant Summary
BOOLEAN
           
DATA
           
DATA_CONTEXT
           
INT
           
MACRO
           
STRING
           
VALUE
           
VAR_NAME
           
VOID
           
 
Field Summary
 String symbol
          The Java literal representing the type (e.g.
static JavaExpression.Type UNKNOWN
          Useful constant for unknown types
 
Method Summary
protected abstract  JavaExpression cast(JavaExpression expression)
          Unconditionally casts the given expression to the type.
static JavaExpression.Type valueOf(String name)
          Returns the enum constant of this type with the specified name.
static JavaExpression.Type[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

STRING

public static final JavaExpression.Type STRING

INT

public static final JavaExpression.Type INT

BOOLEAN

public static final JavaExpression.Type BOOLEAN

VALUE

public static final JavaExpression.Type VALUE

DATA

public static final JavaExpression.Type DATA

VAR_NAME

public static final JavaExpression.Type VAR_NAME

DATA_CONTEXT

public static final JavaExpression.Type DATA_CONTEXT

MACRO

public static final JavaExpression.Type MACRO

VOID

public static final JavaExpression.Type VOID
Field Detail

UNKNOWN

public static final JavaExpression.Type UNKNOWN
Useful constant for unknown types


symbol

public final String symbol
The Java literal representing the type (e.g. "int", "boolean", "Value")

Method Detail

values

public static JavaExpression.Type[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (JavaExpression.Type c : JavaExpression.Type.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static JavaExpression.Type valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

cast

protected abstract JavaExpression cast(JavaExpression expression)
Unconditionally casts the given expression to the type. This should only be called after it has been determined that the destination type is not the same as the expression type.



Copyright © 2010-2012 Google. All Rights Reserved.