The staticInitializer probe fragment

The staticInitializer probe fragment type lets you insert new code into the class initializer of every probed class. If the class does not have a class initializer, one will be created.

The staticInitializer fragment code is executed before any of the original code in the class initializer of the probed class. If the probe uses the staticField object, the new static field will be default-constructed before the staticInitializer fragment code executes.

The following data items are available to the staticInitializer fragment:
  • className
  • staticField
  • classSourceFile
  • methodNames
  • methodLineTables

Example
<fragment type="staticInitializer">
  <data type="className" name="cn"/>
  <code>
    System.out.println("[Class " + cn + " is being loaded.]");
  </code>
</fragment>

Parent topic: Probekit Reference

Related reference
The Fragment probe object
The Data probe object
The StaticField probe object

Related information
staticField and staticInitializer example

Copyright IBM Corporation and others 2000, 2004.