isRequired()

ビジネス・オブジェクトの属性が必須属性として定義されているかどうかを調べます。

構文

boolean isRequired(String attribute)
 

パラメーター

attribute
属性の名前。

戻り値

属性値が必須の場合は true を戻し、必須でない場合は false を戻します。

注記

属性が必須として定義されている場合、その属性は null でない値を持つ必要があります。

次の例は、必須属性の値が null である場合に警告をログに記録します。

if ( (customer.isRequired("Address"))
       && (customerBusObj.isNull("Address)) )
    { 
    logWarning(12, "Address is required and cannot be null.");
    }
 else
    {
    //do something else
    }
 

Copyright IBM Corp. 2004