isNull()

Find out whether the value of a business object's attribute is null.

Syntax

boolean isNull(String attribute)
 

Parameters

attribute
The name of an attribute.

Return values

Returns true if the attribute value is null; returns false if it is not null.

Notes

A null indicates no value, in contrast to a zero-length string value, which is detected by calling isBlank(). Test an object with isNull() before using it, because if the object is null, the operation could fail.

An attribute value can be null under these circumstances:

Tip:
Always call isNull() before performing an operation on an attribute that is a child business object or child business object array, because Java does not allow operations on null objects.

Examples

The following example checks whether the Material attribute of the sourcePaperClip business object has a null value.

boolean key = sourcePaperClip.isNull("Material");
 

The following example checks whether the CustAddr attribute of the contract1 business object is null before retrieving it. The attribute retrieval proceeds only if the isNull() check is false, showing that the attribute is not null.

if (! contract1.isNull("CustAddr")) 
    {
    BusObj customerAddress = contract1.getBusObj("CustAddr");
    //do something with the "customerAddress" business object
    }
 

Copyright IBM Corp. 2003