public interface

IJavaConstant

implements IJavaExpression
com.pnfsoftware.jeb.core.units.code.java.IJavaConstant

Class Overview

Java AST interface to represent a literal or constant value.

Constant types are: the eight primitive types (boolean, byte, char, short, int, long, float, double) and the string type.

Rendering of a literal may be customized (overridden).

Summary

[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
Public Methods
abstract IJavaConstant duplicate()
Duplicate this element.
abstract boolean getBoolean()
Retrieve the boolean value.
abstract byte getByte()
Retrieve the byte value.
abstract char getChar()
Retrieve the character value.
abstract double getDouble()
Retrieve the double value.
abstract float getFloat()
Retrieve the float value.
abstract int getInt()
Retrieve the integer value.
abstract long getLong()
Retrieve the long value.
abstract String getName()
Retrieve the optional custom name to override rendering.
abstract short getShort()
Retrieve the short value.
abstract String getString()
Retrieve the string value.
abstract IJavaType getType()
Retrieve the constant type.
abstract boolean isFalse()
Determine if a constant is the false literal.
abstract boolean isMinusOne()
Determine if a constant is a numeric literal whose value is -1.
abstract boolean isNegative()
Determine if a constant is a numeric literal whose value is strictly negative.
abstract boolean isNull()
Determine if the constant is the 'null' literal.
abstract boolean isOne()
Determine if a constant is a numeric literal whose value is 1.
abstract boolean isPositive()
Determine if a constant is a numeric literal whose value is strictly positive.
abstract boolean isString()
Determine if the constant is of type java.lang.String.
abstract boolean isTrue()
Determine if a constant is the true literal.
abstract boolean isZero()
Determine if a constant is a numeric literal whose value is 0.
abstract void setName(String name)
Set a custom name to override rendering.
[Expand]
Inherited Methods
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaExpression

Public Methods

public abstract IJavaConstant duplicate ()

Duplicate this element.

Returns
  • a (possibly) duplicated object of the same type

public abstract boolean getBoolean ()

Retrieve the boolean value.

Returns
  • the value
Throws
IllegalStateException if the constant is not a boolean

public abstract byte getByte ()

Retrieve the byte value.

Returns
  • the byte value
Throws
IllegalStateException if the constant is not a byte

public abstract char getChar ()

Retrieve the character value.

Returns
  • the character value
Throws
IllegalStateException if the constant is not a char

public abstract double getDouble ()

Retrieve the double value.

Returns
  • the double value
Throws
IllegalStateException if the constant is not a double

public abstract float getFloat ()

Retrieve the float value.

Returns
  • the float value
Throws
IllegalStateException if the constant is not a float

public abstract int getInt ()

Retrieve the integer value.

Returns
  • the integer value
Throws
IllegalStateException if the constant is not an int

public abstract long getLong ()

Retrieve the long value.

Returns
  • the long value
Throws
IllegalStateException if the constant is not a long

public abstract String getName ()

Retrieve the optional custom name to override rendering. This is only applicable to non-String immediates.

Returns
  • a name override, or null

public abstract short getShort ()

Retrieve the short value.

Returns
  • the short value
Throws
IllegalStateException if the constant is not a short

public abstract String getString ()

Retrieve the string value.

Returns
  • the string value
Throws
IllegalStateException if the constant is not a string

public abstract IJavaType getType ()

Retrieve the constant type.

Returns
  • the type signature, null if the constant is 'null'

public abstract boolean isFalse ()

Determine if a constant is the false literal. This method does not raise.

Returns
  • true if the constant is a boolean false, false otherwise

public abstract boolean isMinusOne ()

Determine if a constant is a numeric literal whose value is -1. This method does not raise.

Returns
  • true if the constant is a numeric literal whose value is -1, false otherwise

public abstract boolean isNegative ()

Determine if a constant is a numeric literal whose value is strictly negative. This method does not raise.

Returns
  • true if the constant is a numeric literal whose value is strictly negative, false otherwise

public abstract boolean isNull ()

Determine if the constant is the 'null' literal.

Returns
  • true if the constant is 'null'

public abstract boolean isOne ()

Determine if a constant is a numeric literal whose value is 1. This method does not raise.

Returns
  • true if the constant is a numeric literal whose value is 1, false otherwise

public abstract boolean isPositive ()

Determine if a constant is a numeric literal whose value is strictly positive. This method does not raise.

Returns
  • true if the constant is a numeric literal whose value is strictly positive, false otherwise

public abstract boolean isString ()

Determine if the constant is of type java.lang.String. Convenience routine.

Returns
  • true if the constant is a Java string

public abstract boolean isTrue ()

Determine if a constant is the true literal. This method does not raise.

Returns
  • true if the constant is a boolean true, false otherwise

public abstract boolean isZero ()

Determine if a constant is a numeric literal whose value is 0. This method does not raise.

Returns
  • true if the constant is a numeric literal whose value is 0, false otherwise

public abstract void setName (String name)

Set a custom name to override rendering. This is only applicable to non-String immediates.

Parameters
name a name override, or null