net.janino
Class Java.Literal

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

public static class Java.Literal
extends Java.Rvalue


Fields inherited from class net.janino.Java.Rvalue
JUMP_IF_FALSE, JUMP_IF_TRUE
 
Constructor Summary
Java.Literal(Scanner.Location location, java.lang.Object value)
           
 
Method Summary
 IClass compileGet(ClassFile.CodeAttribute codeAttribute)
          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
 
Methods inherited from class net.janino.Java.Atom
getLocation, isType, throwCompileException, throwParseException, toLvalue, toRvalue, toType
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Java.Literal

public Java.Literal(Scanner.Location location,
                    java.lang.Object value)
Method Detail

getType

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

compileGet

public IClass compileGet(ClassFile.CodeAttribute codeAttribute)
                  throws Java.CompileException
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(ClassFile.CodeAttribute)).
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()
Description copied from class: Java.Rvalue
Attempts to evaluate as a constant expression.
Overrides:
getConstantValue in class Java.Rvalue
Following copied from class: net.janino.Java.Rvalue
Returns:
null if value is not constant; otherwise a String, Byte, Short, Integer, Boolean, Character, Float, Long or Double