HyperparameterTuningJob.fromJson constructor

HyperparameterTuningJob.fromJson(
  1. Object? j
)

Implementation

factory HyperparameterTuningJob.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return HyperparameterTuningJob(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    studySpec: switch (json['studySpec']) {
      null => null,
      Object $1 => StudySpec.fromJson($1),
    },
    maxTrialCount: switch (json['maxTrialCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    parallelTrialCount: switch (json['parallelTrialCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    maxFailedTrialCount: switch (json['maxFailedTrialCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    trialJobSpec: switch (json['trialJobSpec']) {
      null => null,
      Object $1 => CustomJobSpec.fromJson($1),
    },
    trials: switch (json['trials']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Trial.fromJson(i)],
      _ => throw const FormatException('"trials" is not a list'),
    },
    state: switch (json['state']) {
      null => JobState.$default,
      Object $1 => JobState.fromJson($1),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    startTime: switch (json['startTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    endTime: switch (json['endTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    updateTime: switch (json['updateTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    error: switch (json['error']) {
      null => null,
      Object $1 => Status.fromJson($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
    encryptionSpec: switch (json['encryptionSpec']) {
      null => null,
      Object $1 => EncryptionSpec.fromJson($1),
    },
    satisfiesPzs: switch (json['satisfiesPzs']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    satisfiesPzi: switch (json['satisfiesPzi']) {
      null => false,
      Object $1 => decodeBool($1),
    },
  );
}