toJson method
Converts a LeaseSpec instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempAcquireTime = acquireTime;
final tempHolderIdentity = holderIdentity;
final tempLeaseDurationSeconds = leaseDurationSeconds;
final tempLeaseTransitions = leaseTransitions;
final tempRenewTime = renewTime;
if (tempAcquireTime != null) {
jsonData['acquireTime'] = tempAcquireTime;
}
if (tempHolderIdentity != null) {
jsonData['holderIdentity'] = tempHolderIdentity;
}
if (tempLeaseDurationSeconds != null) {
jsonData['leaseDurationSeconds'] = tempLeaseDurationSeconds;
}
if (tempLeaseTransitions != null) {
jsonData['leaseTransitions'] = tempLeaseTransitions;
}
if (tempRenewTime != null) {
jsonData['renewTime'] = tempRenewTime;
}
return jsonData;
}