Contents > 9 Extending the Metrics and Rule Engine > 9.4 Boolean Functions > 9.4.3 Using the New Boolean Function

9.4.3 Using the New Boolean Function

To use our new Boolean function, we must register it with the metrics engine. We add the following XML element to our metric definition file:
<booleanoperationdefinition name="xor" 
	class="com.acme.BooleanOperationXOR" />
Attribute name defines the name of the function to be used in condition expressions, attribute class defines the fully qualified name of the Boolean function class.

At runtime, the Boolean function class must be included in the class path of SDMetrics. The simplest way to achieve this is by putting the class files in the "bin" folder of the SDMetrics installation directory. SDMetrics searches this directory for class files.

Within the "bin" directory, we have to create a structure of subfolders that reflects the packages of the classes we provide. The class file for class com.acme.BooleanOperationXOR therefore will be located at the path bin/com/acme/BooleanOperationXOR.class.