I came across the below code in a Groovy project:
payloadDetails?.with {
payloadDetails.ardome.material_id = testAsset.materialId.trim()
payloadDetails.ardome.itm_id = testAsset.itemId.trim()
payloadDetails.ardome.mob_id = testAsset.mobId.trim()
payloadDetails.ardome.min_id = testAsset.minId.trim()
payloadDetails.ardome.original_ardome_filename = testAsset.originalFileName.trim()
}
where 'payloadDetails' variable is the return value of below (Map I assume):
static Map getCreateIndexPayload(String payloadName = 'CreateIndexPayload') {
//some code
}
So ? is the null safe operator, but what is the .with() method?
It looks like it's a method that allows reassigning Map's all or partial value member one by one. But I am not able to find this .with() definition in Map's interface document, or is it a method of Collection interface?
Is API documentation available for this method?