fromJson static method

ModelMapping fromJson(
  1. dynamic value
)

Returns a new ModelMapping instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static ModelMapping fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();
    return ModelMapping(
      mappingId: mapValueOfType<String>(json, r'MappingId'),
      sourceAssetModelId: mapValueOfType<int>(json, r'SourceAssetModelId'),
      targetAssetModelId: mapValueOfType<int>(json, r'TargetAssetModelId'),
      createdByAssetModelId: mapValueOfType<int>(json, r'CreatedByAssetModelId'),
      createdByContactId: mapValueOfType<int>(json, r'CreatedByContactId'),
      createdBy: Contact.fromJson(json[r'CreatedBy']),
      sourceAssetModel: ModelInfo.fromJson(json[r'SourceAssetModel']),
      targetAssetModel: ModelInfo.fromJson(json[r'TargetAssetModel']),
      dateCreated: mapDateTime(json, r'DateCreated', ''),
      hasFootprints: mapValueOfType<bool>(json, r'HasFootprints'),
      footPrintsAreAligned: mapValueOfType<bool>(json, r'FootPrintsAreAligned'),
      lostEntities: Entity.listFromJson(json[r'LostEntities']),
      foundEntities: Entity.listFromJson(json[r'FoundEntities']),
      mappedEntities: EntityMappingInfo.listFromJson(json[r'MappedEntities']),
      candidateMatches: EntityMatchInfo.listFromJson(json[r'CandidateMatches']),
      messages: MappingMessageInfo.listFromJson(json[r'Messages']),
    );
  }
  return null;
}