Class Constant

java.lang.Object
edu.umd.cs.findbugs.ba.constant.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:
  • Field Details

    • NOT_CONSTANT

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

    • Constant

      public Constant(@Nullable Object value)
      Constructor for a constant value.
      Parameters:
      value - the constant value; must be a String, Integer, etc.
  • Method Details

    • getConstantValue

      public Object getConstantValue()
    • isConstant

      public boolean isConstant()
      Return whether or not this value is a constant.
      Returns:
      true if the value is a constant, 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
    • getConstantString

      public String getConstantString()
      Get the constant String value of this value.
      Returns:
      the constant String value
    • 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
    • getConstantInt

      public int getConstantInt()
      Get the constant int value of this value.
      Returns:
      the constant int value
    • merge

      public static Constant merge(Constant a, Constant b)
      Merge two Constnts.
      Parameters:
      a - a StaticConstant
      b - another StaticConstant
      Returns:
      the merge (dataflow meet) of the two Constants
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object