001package org.anarres.qemu.qapi.api; 002 003import com.fasterxml.jackson.annotation.JsonIgnore; 004import com.fasterxml.jackson.annotation.JsonInclude; 005import com.fasterxml.jackson.annotation.JsonProperty; 006import com.fasterxml.jackson.annotation.JsonUnwrapped; 007import com.fasterxml.jackson.annotation.JsonValue; 008import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 009import javax.annotation.CheckForNull; 010import javax.annotation.Nonnull; 011import org.anarres.qemu.qapi.common.*; 012 013/** 014 * Autogenerated class. 015 * 016 * <pre>QApiUnionDescriptor{name=BlockdevOptions, discriminator=driver, data={archipelago=BlockdevOptionsArchipelago, blkdebug=BlockdevOptionsBlkdebug, blkverify=BlockdevOptionsBlkverify, bochs=BlockdevOptionsGenericFormat, cloop=BlockdevOptionsGenericFormat, dmg=BlockdevOptionsGenericFormat, file=BlockdevOptionsFile, ftp=BlockdevOptionsFile, ftps=BlockdevOptionsFile, host_cdrom=BlockdevOptionsFile, host_device=BlockdevOptionsFile, http=BlockdevOptionsFile, https=BlockdevOptionsFile, null-aio=BlockdevOptionsNull, null-co=BlockdevOptionsNull, parallels=BlockdevOptionsGenericFormat, qcow2=BlockdevOptionsQcow2, qcow=BlockdevOptionsGenericCOWFormat, qed=BlockdevOptionsGenericCOWFormat, quorum=BlockdevOptionsQuorum, raw=BlockdevOptionsGenericFormat, tftp=BlockdevOptionsFile, vdi=BlockdevOptionsGenericFormat, vhdx=BlockdevOptionsGenericFormat, vmdk=BlockdevOptionsGenericCOWFormat, vpc=BlockdevOptionsGenericFormat, vvfat=BlockdevOptionsVVFAT}, innerTypes=null, fields=null, discriminatorField=null}</pre> 017 */ 018@JsonInclude(JsonInclude.Include.NON_EMPTY) 019public class BlockdevOptions extends BlockdevOptionsBase implements QApiUnion { 020 021 // union { 022 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 023 @JsonProperty("archipelago") 024 @JsonUnwrapped 025 @CheckForNull 026 public BlockdevOptionsArchipelago archipelago; 027 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 028 @JsonProperty("blkdebug") 029 @JsonUnwrapped 030 @CheckForNull 031 public BlockdevOptionsBlkdebug blkdebug; 032 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 033 @JsonProperty("blkverify") 034 @JsonUnwrapped 035 @CheckForNull 036 public BlockdevOptionsBlkverify blkverify; 037 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 038 @JsonProperty("bochs") 039 @JsonUnwrapped 040 @CheckForNull 041 public BlockdevOptionsGenericFormat bochs; 042 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 043 @JsonProperty("cloop") 044 @JsonUnwrapped 045 @CheckForNull 046 public BlockdevOptionsGenericFormat cloop; 047 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 048 @JsonProperty("dmg") 049 @JsonUnwrapped 050 @CheckForNull 051 public BlockdevOptionsGenericFormat dmg; 052 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 053 @JsonProperty("file") 054 @JsonUnwrapped 055 @CheckForNull 056 public BlockdevOptionsFile file; 057 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 058 @JsonProperty("ftp") 059 @JsonUnwrapped 060 @CheckForNull 061 public BlockdevOptionsFile ftp; 062 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 063 @JsonProperty("ftps") 064 @JsonUnwrapped 065 @CheckForNull 066 public BlockdevOptionsFile ftps; 067 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 068 @JsonProperty("host_cdrom") 069 @JsonUnwrapped 070 @CheckForNull 071 public BlockdevOptionsFile hostCdrom; 072 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 073 @JsonProperty("host_device") 074 @JsonUnwrapped 075 @CheckForNull 076 public BlockdevOptionsFile hostDevice; 077 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 078 @JsonProperty("http") 079 @JsonUnwrapped 080 @CheckForNull 081 public BlockdevOptionsFile http; 082 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 083 @JsonProperty("https") 084 @JsonUnwrapped 085 @CheckForNull 086 public BlockdevOptionsFile https; 087 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 088 @JsonProperty("null-aio") 089 @JsonUnwrapped 090 @CheckForNull 091 public BlockdevOptionsNull nullAio; 092 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 093 @JsonProperty("null-co") 094 @JsonUnwrapped 095 @CheckForNull 096 public BlockdevOptionsNull nullCo; 097 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 098 @JsonProperty("parallels") 099 @JsonUnwrapped 100 @CheckForNull 101 public BlockdevOptionsGenericFormat parallels; 102 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 103 @JsonProperty("qcow2") 104 @JsonUnwrapped 105 @CheckForNull 106 public BlockdevOptionsQcow2 qcow2; 107 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 108 @JsonProperty("qcow") 109 @JsonUnwrapped 110 @CheckForNull 111 public BlockdevOptionsGenericCOWFormat qcow; 112 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 113 @JsonProperty("qed") 114 @JsonUnwrapped 115 @CheckForNull 116 public BlockdevOptionsGenericCOWFormat qed; 117 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 118 @JsonProperty("quorum") 119 @JsonUnwrapped 120 @CheckForNull 121 public BlockdevOptionsQuorum quorum; 122 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 123 @JsonProperty("raw") 124 @JsonUnwrapped 125 @CheckForNull 126 public BlockdevOptionsGenericFormat raw; 127 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 128 @JsonProperty("tftp") 129 @JsonUnwrapped 130 @CheckForNull 131 public BlockdevOptionsFile tftp; 132 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 133 @JsonProperty("vdi") 134 @JsonUnwrapped 135 @CheckForNull 136 public BlockdevOptionsGenericFormat vdi; 137 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 138 @JsonProperty("vhdx") 139 @JsonUnwrapped 140 @CheckForNull 141 public BlockdevOptionsGenericFormat vhdx; 142 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 143 @JsonProperty("vmdk") 144 @JsonUnwrapped 145 @CheckForNull 146 public BlockdevOptionsGenericCOWFormat vmdk; 147 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 148 @JsonProperty("vpc") 149 @JsonUnwrapped 150 @CheckForNull 151 public BlockdevOptionsGenericFormat vpc; 152 @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") 153 @JsonProperty("vvfat") 154 @JsonUnwrapped 155 @CheckForNull 156 public BlockdevOptionsVVFAT vvfat; 157 // } 158 159 @Nonnull 160 public static BlockdevOptions archipelago(@Nonnull BlockdevOptionsArchipelago archipelago) { 161 BlockdevOptions self = new BlockdevOptions(); 162 self.driver = BlockdevDriver.archipelago; 163 self.archipelago = archipelago; 164 return self; 165 } 166 167 @Nonnull 168 public static BlockdevOptions blkdebug(@Nonnull BlockdevOptionsBlkdebug blkdebug) { 169 BlockdevOptions self = new BlockdevOptions(); 170 self.driver = BlockdevDriver.blkdebug; 171 self.blkdebug = blkdebug; 172 return self; 173 } 174 175 @Nonnull 176 public static BlockdevOptions blkverify(@Nonnull BlockdevOptionsBlkverify blkverify) { 177 BlockdevOptions self = new BlockdevOptions(); 178 self.driver = BlockdevDriver.blkverify; 179 self.blkverify = blkverify; 180 return self; 181 } 182 183 @Nonnull 184 public static BlockdevOptions bochs(@Nonnull BlockdevOptionsGenericFormat bochs) { 185 BlockdevOptions self = new BlockdevOptions(); 186 self.driver = BlockdevDriver.bochs; 187 self.bochs = bochs; 188 return self; 189 } 190 191 @Nonnull 192 public static BlockdevOptions cloop(@Nonnull BlockdevOptionsGenericFormat cloop) { 193 BlockdevOptions self = new BlockdevOptions(); 194 self.driver = BlockdevDriver.cloop; 195 self.cloop = cloop; 196 return self; 197 } 198 199 @Nonnull 200 public static BlockdevOptions dmg(@Nonnull BlockdevOptionsGenericFormat dmg) { 201 BlockdevOptions self = new BlockdevOptions(); 202 self.driver = BlockdevDriver.dmg; 203 self.dmg = dmg; 204 return self; 205 } 206 207 @Nonnull 208 public static BlockdevOptions file(@Nonnull BlockdevOptionsFile file) { 209 BlockdevOptions self = new BlockdevOptions(); 210 self.driver = BlockdevDriver.file; 211 self.file = file; 212 return self; 213 } 214 215 @Nonnull 216 public static BlockdevOptions ftp(@Nonnull BlockdevOptionsFile ftp) { 217 BlockdevOptions self = new BlockdevOptions(); 218 self.driver = BlockdevDriver.ftp; 219 self.ftp = ftp; 220 return self; 221 } 222 223 @Nonnull 224 public static BlockdevOptions ftps(@Nonnull BlockdevOptionsFile ftps) { 225 BlockdevOptions self = new BlockdevOptions(); 226 self.driver = BlockdevDriver.ftps; 227 self.ftps = ftps; 228 return self; 229 } 230 231 @Nonnull 232 public static BlockdevOptions hostCdrom(@Nonnull BlockdevOptionsFile hostCdrom) { 233 BlockdevOptions self = new BlockdevOptions(); 234 self.driver = BlockdevDriver.host_cdrom; 235 self.hostCdrom = hostCdrom; 236 return self; 237 } 238 239 @Nonnull 240 public static BlockdevOptions hostDevice(@Nonnull BlockdevOptionsFile hostDevice) { 241 BlockdevOptions self = new BlockdevOptions(); 242 self.driver = BlockdevDriver.host_device; 243 self.hostDevice = hostDevice; 244 return self; 245 } 246 247 @Nonnull 248 public static BlockdevOptions http(@Nonnull BlockdevOptionsFile http) { 249 BlockdevOptions self = new BlockdevOptions(); 250 self.driver = BlockdevDriver.http; 251 self.http = http; 252 return self; 253 } 254 255 @Nonnull 256 public static BlockdevOptions https(@Nonnull BlockdevOptionsFile https) { 257 BlockdevOptions self = new BlockdevOptions(); 258 self.driver = BlockdevDriver.https; 259 self.https = https; 260 return self; 261 } 262 263 @Nonnull 264 public static BlockdevOptions nullAio(@Nonnull BlockdevOptionsNull nullAio) { 265 BlockdevOptions self = new BlockdevOptions(); 266 self.driver = BlockdevDriver.null_aio; 267 self.nullAio = nullAio; 268 return self; 269 } 270 271 @Nonnull 272 public static BlockdevOptions nullCo(@Nonnull BlockdevOptionsNull nullCo) { 273 BlockdevOptions self = new BlockdevOptions(); 274 self.driver = BlockdevDriver.null_co; 275 self.nullCo = nullCo; 276 return self; 277 } 278 279 @Nonnull 280 public static BlockdevOptions parallels(@Nonnull BlockdevOptionsGenericFormat parallels) { 281 BlockdevOptions self = new BlockdevOptions(); 282 self.driver = BlockdevDriver.parallels; 283 self.parallels = parallels; 284 return self; 285 } 286 287 @Nonnull 288 public static BlockdevOptions qcow2(@Nonnull BlockdevOptionsQcow2 qcow2) { 289 BlockdevOptions self = new BlockdevOptions(); 290 self.driver = BlockdevDriver.qcow2; 291 self.qcow2 = qcow2; 292 return self; 293 } 294 295 @Nonnull 296 public static BlockdevOptions qcow(@Nonnull BlockdevOptionsGenericCOWFormat qcow) { 297 BlockdevOptions self = new BlockdevOptions(); 298 self.driver = BlockdevDriver.qcow; 299 self.qcow = qcow; 300 return self; 301 } 302 303 @Nonnull 304 public static BlockdevOptions qed(@Nonnull BlockdevOptionsGenericCOWFormat qed) { 305 BlockdevOptions self = new BlockdevOptions(); 306 self.driver = BlockdevDriver.qed; 307 self.qed = qed; 308 return self; 309 } 310 311 @Nonnull 312 public static BlockdevOptions quorum(@Nonnull BlockdevOptionsQuorum quorum) { 313 BlockdevOptions self = new BlockdevOptions(); 314 self.driver = BlockdevDriver.quorum; 315 self.quorum = quorum; 316 return self; 317 } 318 319 @Nonnull 320 public static BlockdevOptions raw(@Nonnull BlockdevOptionsGenericFormat raw) { 321 BlockdevOptions self = new BlockdevOptions(); 322 self.driver = BlockdevDriver.raw; 323 self.raw = raw; 324 return self; 325 } 326 327 @Nonnull 328 public static BlockdevOptions tftp(@Nonnull BlockdevOptionsFile tftp) { 329 BlockdevOptions self = new BlockdevOptions(); 330 self.driver = BlockdevDriver.tftp; 331 self.tftp = tftp; 332 return self; 333 } 334 335 @Nonnull 336 public static BlockdevOptions vdi(@Nonnull BlockdevOptionsGenericFormat vdi) { 337 BlockdevOptions self = new BlockdevOptions(); 338 self.driver = BlockdevDriver.vdi; 339 self.vdi = vdi; 340 return self; 341 } 342 343 @Nonnull 344 public static BlockdevOptions vhdx(@Nonnull BlockdevOptionsGenericFormat vhdx) { 345 BlockdevOptions self = new BlockdevOptions(); 346 self.driver = BlockdevDriver.vhdx; 347 self.vhdx = vhdx; 348 return self; 349 } 350 351 @Nonnull 352 public static BlockdevOptions vmdk(@Nonnull BlockdevOptionsGenericCOWFormat vmdk) { 353 BlockdevOptions self = new BlockdevOptions(); 354 self.driver = BlockdevDriver.vmdk; 355 self.vmdk = vmdk; 356 return self; 357 } 358 359 @Nonnull 360 public static BlockdevOptions vpc(@Nonnull BlockdevOptionsGenericFormat vpc) { 361 BlockdevOptions self = new BlockdevOptions(); 362 self.driver = BlockdevDriver.vpc; 363 self.vpc = vpc; 364 return self; 365 } 366 367 @Nonnull 368 public static BlockdevOptions vvfat(@Nonnull BlockdevOptionsVVFAT vvfat) { 369 BlockdevOptions self = new BlockdevOptions(); 370 self.driver = BlockdevDriver.vvfat; 371 self.vvfat = vvfat; 372 return self; 373 } 374 375 @Override 376 public java.util.List<java.lang.String> getFieldNames() { 377 java.util.List<java.lang.String> names = super.getFieldNames(); 378 names.add("archipelago"); 379 names.add("blkdebug"); 380 names.add("blkverify"); 381 names.add("bochs"); 382 names.add("cloop"); 383 names.add("dmg"); 384 names.add("file"); 385 names.add("ftp"); 386 names.add("ftps"); 387 names.add("host_cdrom"); 388 names.add("host_device"); 389 names.add("http"); 390 names.add("https"); 391 names.add("null-aio"); 392 names.add("null-co"); 393 names.add("parallels"); 394 names.add("qcow2"); 395 names.add("qcow"); 396 names.add("qed"); 397 names.add("quorum"); 398 names.add("raw"); 399 names.add("tftp"); 400 names.add("vdi"); 401 names.add("vhdx"); 402 names.add("vmdk"); 403 names.add("vpc"); 404 names.add("vvfat"); 405 return names; 406 } 407 408 @JsonIgnore 409 @Override 410 public Object getFieldByName(@Nonnull java.lang.String name) throws NoSuchFieldException { 411 if ("archipelago".equals(name)) 412 return archipelago; 413 if ("blkdebug".equals(name)) 414 return blkdebug; 415 if ("blkverify".equals(name)) 416 return blkverify; 417 if ("bochs".equals(name)) 418 return bochs; 419 if ("cloop".equals(name)) 420 return cloop; 421 if ("dmg".equals(name)) 422 return dmg; 423 if ("file".equals(name)) 424 return file; 425 if ("ftp".equals(name)) 426 return ftp; 427 if ("ftps".equals(name)) 428 return ftps; 429 if ("host_cdrom".equals(name)) 430 return hostCdrom; 431 if ("host_device".equals(name)) 432 return hostDevice; 433 if ("http".equals(name)) 434 return http; 435 if ("https".equals(name)) 436 return https; 437 if ("null-aio".equals(name)) 438 return nullAio; 439 if ("null-co".equals(name)) 440 return nullCo; 441 if ("parallels".equals(name)) 442 return parallels; 443 if ("qcow2".equals(name)) 444 return qcow2; 445 if ("qcow".equals(name)) 446 return qcow; 447 if ("qed".equals(name)) 448 return qed; 449 if ("quorum".equals(name)) 450 return quorum; 451 if ("raw".equals(name)) 452 return raw; 453 if ("tftp".equals(name)) 454 return tftp; 455 if ("vdi".equals(name)) 456 return vdi; 457 if ("vhdx".equals(name)) 458 return vhdx; 459 if ("vmdk".equals(name)) 460 return vmdk; 461 if ("vpc".equals(name)) 462 return vpc; 463 if ("vvfat".equals(name)) 464 return vvfat; 465 return super.getFieldByName(name); 466 } 467 468 @Override 469 @JsonIgnore 470 public boolean isValidUnion() { 471 int count = 0; 472 if (archipelago != null) 473 count++; 474 if (blkdebug != null) 475 count++; 476 if (blkverify != null) 477 count++; 478 if (bochs != null) 479 count++; 480 if (cloop != null) 481 count++; 482 if (dmg != null) 483 count++; 484 if (file != null) 485 count++; 486 if (ftp != null) 487 count++; 488 if (ftps != null) 489 count++; 490 if (hostCdrom != null) 491 count++; 492 if (hostDevice != null) 493 count++; 494 if (http != null) 495 count++; 496 if (https != null) 497 count++; 498 if (nullAio != null) 499 count++; 500 if (nullCo != null) 501 count++; 502 if (parallels != null) 503 count++; 504 if (qcow2 != null) 505 count++; 506 if (qcow != null) 507 count++; 508 if (qed != null) 509 count++; 510 if (quorum != null) 511 count++; 512 if (raw != null) 513 count++; 514 if (tftp != null) 515 count++; 516 if (vdi != null) 517 count++; 518 if (vhdx != null) 519 count++; 520 if (vmdk != null) 521 count++; 522 if (vpc != null) 523 count++; 524 if (vvfat != null) 525 count++; 526 return (count == 1); 527 } 528}