net.janino
Class Java.ConstantValue

java.lang.Object
  |
  +--net.janino.Java.Located
        |
        +--net.janino.Java.Atom
              |
              +--net.janino.Java.Rvalue
                    |
                    +--net.janino.Java.ConstantValue
All Implemented Interfaces:
Java.Locatable
Enclosing class:
Java

public static class Java.ConstantValue
extends Java.Rvalue


Fields inherited from class net.janino.Java.Rvalue
CONSTANT_VALUE_NULL, JUMP_IF_FALSE, JUMP_IF_TRUE
 
Constructor Summary
Java.ConstantValue(Scanner.Location location, java.lang.Object constantValue)
           
 
Method Summary
 IClass compileGet()
          Generates code that determines the value of the Java.Rvalue and puts it on the operand stack.
 java.lang.Object getConstantValue()
          Attempts to evaluate as a constant expression.
 IClass getType()
           
 
Methods inherited from class net.janino.Java.Rvalue
compile, compileBoolean, compileContext, compileGetValue, getNegatedConstantValue, toRvalue
 
Methods inherited from class net.janino.Java.Atom
addConstantFloatInfo, addConstantIntegerInfo, addConstantStringInfo, allocateLocalVariable, compileError, createDummyCodeAttribute, getLocation, isType, newInserter, newOffset, newUnsetOffset, popInserter, pushInserter, restoreLocalVariables, saveLocalVariables, throwParseException, toLvalue, toLvalueOrCE, toLvalueOrPE, toRvalueOrCE, toRvalueOrPE, toType, toTypeOrCE, toTypeOrPE, write, writeBranch, writeByte, writeConstantClassInfo, writeConstantDoubleInfo, writeConstantFieldrefInfo, writeConstantFloatInfo, writeConstantIntegerInfo, writeConstantInterfaceMethodrefInfo, writeConstantLongInfo, writeConstantMethodrefInfo, writeConstantStringInfo, writeInt, writeOffset, writeOpcode, writeShort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Java.ConstantValue

public Java.ConstantValue(Scanner.Location location,
                          java.lang.Object constantValue)
Method Detail

getType

public IClass getType()
Overrides:
getType in class Java.Atom

compileGet

public IClass compileGet()
Description copied from class: Java.Rvalue
Generates code that determines the value of the Java.Rvalue and puts it on the operand stack. This method relies on that the "context" of the Java.Rvalue is on top of the operand stack (see Java.Rvalue.compileContext()).
Overrides:
compileGet in class Java.Rvalue
Following copied from class: net.janino.Java.Rvalue
Returns:
The type of the Java.Rvalue

getConstantValue

public java.lang.Object getConstantValue()
                                  throws Java.CompileException
Description copied from class: Java.Rvalue
Attempts to evaluate as a constant expression.

Expression typeReturn value type
StringString
byteByte
shortChort
intInteger
booleanBoolean
charCharacter
floatFloat
longLong
doubleDouble
nullJava.Rvalue.CONSTANT_VALUE_NULL

Overrides:
getConstantValue in class Java.Rvalue