001/*
002 * To change this template, choose Tools | Templates
003 * and open the template in the editor.
004 */
005package org.anarres.qemu.exec;
006
007import java.util.List;
008import java.util.UUID;
009import javax.annotation.CheckForNull;
010import javax.annotation.Nonnull;
011
012/**
013 *
014 * @author shevek
015 */
016public class QEmuIdOption extends AbstractQEmuOption {
017
018    private UUID uuid;
019    private String name;
020
021    public QEmuIdOption(@CheckForNull UUID uuid, @CheckForNull String name) {
022        this.uuid = uuid;
023        this.name = name;
024    }
025
026    public QEmuIdOption(@CheckForNull String name) {
027        this(null, name);
028    }
029
030    public QEmuIdOption(@CheckForNull UUID uuid) {
031        this(uuid, null);
032    }
033
034    public QEmuIdOption() {
035    }
036
037    @CheckForNull
038    public UUID getUuid() {
039        return uuid;
040    }
041
042    @Nonnull
043    public QEmuIdOption withUuid(@Nonnull UUID uuid) {
044        this.uuid = uuid;
045        return this;
046    }
047
048    @Nonnull
049    public QEmuIdOption withName(@Nonnull String name) {
050        this.name = name;
051        return this;
052    }
053
054    @Override
055    public void appendTo(List<? super String> line) {
056        if (uuid != null)
057            add(line, "-uuid", uuid);
058        if (name != null)
059            add(line, "-name", name);
060    }
061}