edu.umd.cs.findbugs.ba.constant

Class Constant

public class Constant extends Object

Abstract dataflow value representing a value which may or may not be a constant.

Author: David Hovemeyer

See Also: ConstantAnalysis

Field Summary
static ConstantNOT_CONSTANT
Single instance representing all non-constant values.
Constructor Summary
Constant(Object value)
Constructor for a constant value.
Method Summary
intgetConstantInt()
Get the constant int value of this value.
StringgetConstantString()
Get the constant String value of this value.
booleanisConstant()
Return whether or not this value is a constant.
booleanisConstantInteger()
Return whether or not this value is a constant int/Integer.
booleanisConstantString()
Return whether or not this value is a constant String.
static Constantmerge(Constant a, Constant b)
Merge two Constants.

Field Detail

NOT_CONSTANT

public static final Constant NOT_CONSTANT
Single instance representing all non-constant values.

Constructor Detail

Constant

public Constant(Object value)
Constructor for a constant value.

Parameters: value the constant value; must be a String, Integer, etc.

Method Detail

getConstantInt

public int getConstantInt()
Get the constant int value of this value.

Returns: the constant int value

getConstantString

public String getConstantString()
Get the constant String value of this value.

Returns: the constant String value

isConstant

public boolean isConstant()
Return whether or not this value is a constant.

Returns: true if the value is a constant, false if not

isConstantInteger

public boolean isConstantInteger()
Return whether or not this value is a constant int/Integer.

Returns: true if the value is a constant int/Integer, false if not

isConstantString

public boolean isConstantString()
Return whether or not this value is a constant String.

Returns: true if the value is a constant String, false if not

merge

public static Constant merge(Constant a, Constant b)
Merge two Constants.

Parameters: a a Constant b another Constant

Returns: the merge (dataflow meet) of the two Constants

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.