简体   繁体   中英

Checking object as null using objectutils failed

I am using ObjectUtils.isEmpty() as generic to check for the null and empty fields.It was working fine for the term like:

MyClass class = new MyClass()
class.setName(null);

if (!ObjectUtils.isEmpty(class.getName)) {
    return "Name";
}

But it is not working , when am trying it for the Object as below:

Object activatedDate = jsonObject.getJSONArray("records")
          .getJSONObject(i).get("ActivatedDate");
return ObjectUtils.isEmpty(activatedDate) ? null : "hello";

and My json is:

[
  {
    "LastModifiedDate": "2018-05-23T10:58:18.000+0000",
    "Order_Submission_Outcome__c": "test",
    "Number_of_Orders__c": 0,
    "Sales_Code__c": null,
    "Opportunity__c": "FERERR",
    "Contract_Type__c": "EZ Order Form",
    "StatusCode": "Draft",
    "CreatedDate": "2018-05-23T10:56:22.000+0000",
    "Id": "FERERR",
    "ActivatedDate": null,
    "Contract_Status__c": "ACTIVE",
    "Opportunity_Act_Total_Lines__c": 1
  }
]

But it always returns hello even though the object activatedDate is null. What is the problem?

在JPA QL中,如果要调用数据库函数,则必须这样进行:

function(‘FUNC_NAME’, param1, param2,...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM