# Class LineNumberGen

java.lang.Object
org.apache.bcel.generic.LineNumberGen

All Implemented Interfaces:
  `Cloneable, InstructionTargeter`

public class LineNumberGen extends Object implements InstructionTargeter, Cloneable
This class represents a line number within a method, i.e., give an instruction a line number corresponding to the source code line.

See Also:
  - `LineNumber`
  - `MethodGen`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LineNumberGen(InstructionHandle ih, int srcLine)`
  Create a line number.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `clone()`
  `boolean`
  `containsTarget(InstructionHandle ih)`
  Tests whether this targeter targets the specified instruction handle.
  `InstructionHandle`
  `getInstruction()`
  `LineNumber`
  `getLineNumber()`
  Gets LineNumber attribute.
  `int`
  `getSourceLine()`
  `void`
  `setInstruction(InstructionHandle instructionHandle)`
  `void`
  `setSourceLine(int srcLine)`
  `void`
  `updateTarget(InstructionHandle oldIh, InstructionHandle newIh)`
  Replaces the target of this targeter from this old handle to the new handle.

  ### Methods inherited from class Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LineNumberGen

    public LineNumberGen(InstructionHandle ih, int srcLine)
    Create a line number.
    Parameters:
      `ih` - instruction handle to reference

- ## Method Details

  - ### clone

    public Object clone()
    Overrides:
      `clone` in class `Object`

  - ### containsTarget

    public boolean containsTarget(InstructionHandle ih)
    Description copied from interface: `InstructionTargeter`
    Tests whether this targeter targets the specified instruction handle.
    Specified by:
      `containsTarget` in interface `InstructionTargeter`
    Parameters:
      `ih` - the instruction handle to test.
    Returns:
      true, if ih is target of this line number

  - ### getInstruction

    public InstructionHandle getInstruction()

  - ### getLineNumber

    public LineNumber getLineNumber()
    Gets LineNumber attribute. This relies on that the instruction list has already been dumped to byte code or that the 'setPositions' methods has been called for the instruction list.

  - ### getSourceLine

    public int getSourceLine()

  - ### setInstruction

    public void setInstruction(InstructionHandle instructionHandle)

  - ### setSourceLine

    public void setSourceLine(int srcLine)

  - ### updateTarget

    public void updateTarget(InstructionHandle oldIh, InstructionHandle newIh)
    Description copied from interface: `InstructionTargeter`
    Replaces the target of this targeter from this old handle to the new handle.
    Specified by:
      `updateTarget` in interface `InstructionTargeter`
    Parameters:
      `oldIh` - old target
      `newIh` - new target